Chris Oliver


238,150 Experience
17 Lessons Completed
260 Questions Solved


Posted in How to import data with many associations?

You can specify the column on your association that's used for joining tables. You'd just specify that old_id column and you should be good to go.

Posted in Multitenancy with Apartment Gem

@Vitor the Apartment docs should have a good explanation for that. 👍

I would use a Stimulus controller to listen for "change" event on the radios and then update the hidden fields accordingly.

You can either:

  1. Add some code to the model to transform the selected value here to what you want in the attributes before_validation
  2. Add Javascript to change hidden fields based upon the selection

I'd probably go with Javascript personally in this case as I think it'd be a little simpler.

Posted in Is this a good fit for storing JSON in database?

Seems like a perfect use case to me. You can add / remove options easily in the future without adding more migrations and that'll make maintaining the filter and options a lot easier.

You might look into some of the gems that enforce types on the options if you need to make sure things are cast to booleans, ints, etc.

Posted in Authorization with Pundit Discussion

Might just be a temporary issue on Wistia. It's not loading for me either.

Posted in Any news on the install Rails on Catalina guide?

Oh nice! I haven't made the upgrade quite yet.

Anything in particular you'd want to see? Mostly it operates the same as bash, just with a few niceties and you can use things like oh-my-zsh which I believe I talked about in this episode:

Posted in Where to read about changes between Ruby versions?

Mostly I just look at for the notes in the blog posts.

Posted in Where is the search bar?

Strange. What does thr javascript console say for errors?

Posted in Where is the search bar?

Try using the search icon in the navbar.

This would be a good one for the Rails github issue tracker.

I would bet they don't have that by default, but could probably be done by pasting the Rails source into your app, editing the toolbar for Trix, and then including your modified copy instead of the Rails JS for it.

ActionCable works great for this. Once the background job retrieves the data, you can have it send an updated partial over to the user and replace it on the page. I do this for server and app status updates on Hatchbox. Works great.

Posted in Ruby & Rails Courses

Awesome! I've got a long weekend out of town, but when I get back I can probably crank on a few episodes that start from the very basics.

Posted in How do I work out time slots greater than 5 hours

I don't think there's any way to do this in the database with the current setup, so what you're doing is probably what I would do.

You could cache the results of the report and re-calculate them every day or week on a regular basis so you don't have to run this expensive calculation all the time.

I'd probably stick with what you've got.

Posted in Suggested changes to Ubuntu 18.04 documentation

haha! ive done that many times myself. Coding while tired doesnt work out very well.

Maybe a cool feature to add is checkboxes so you can see which steps youve completed!

Posted in Make http POST request that return xml response

You can run that code in the console by running the same code as you would in your app. response =

The response will be the return value of start as it currently is setup.

Posted in Suggested changes to Ubuntu 18.04 documentation

The "Installing Ruby" step covers installing git, node, yarn, build essentials and the libssl, libreadline and zlib libraries. Sounds like you might have missed those steps.

Posted in Rails6 autorization method

Most of us prefer the Pundit gem for that. There's an episode on it as well. 👍

Posted in Payment Rails Master Class (SCA) ready?

Not quite yet! I'm still working on it but keep getting distracted with other things. I'm hoping next week I can dedicated a lot of time to getting it all figured out and then re-record the course after that.

Moving a database isn't so easy. You typically incur downtime, or you have to setup streaming replicas and things that are complicated.

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.