Chris Oliver


247,160 Experience
18 Lessons Completed
271 Questions Solved


Posted in Liking Posts Discussion

"Bookmark" might be an easier name to work with on the backend and then just use a different term for the UI.

Posted in Liking Posts Discussion

Yeah, if you ever overwrote the save method like with an association, then that would cause problems. Almost certainly was your issue.

Hey Muhammad, I think you'll need to take a look at /var/log/nging/error.log and see why it's failing. You can also run nginx -t to determine if you have a valid config. It might just be that you have a typo in your config somewhere.

Posted in How to monitor account progress?

Sorry it took me a bit longer than I hoped. Just published an episode on this today!

Posted in in app notifications using stimulus and ujs

You have to .bind(this) if you want to retain the context/scope when passing in a function for a callback, otherwise it will use the callback's scope for this.

        success: this.handleSuccess.bind(this)

Javascript is real weird.


I would say no, you do not not microservices or separate frontend/backends.

You're free to use whatever frontend you want, but in a monolithic app, think of it more like the frontend dev works on the views, css and javascript while you handle more of the controllers and models. You can get everything ready for the frontend dev, setting up forms and instance variables so they can go ahead and work with the data you provided them.

That collaboration can work if you're using a frontend framework too though. You would provide urls for them to retrieve data, but there's no need for that unless you want to.

Posted in User Referral Program From Scratch Discussion

What's the error?

Hey Umar!

I've worked a lot in the past with frontend devs as the only backend developer. For the most part, we split responsibilities such that the frontend dev would tell me what information they needed, and we would figure out the params and response formats for API requests. We'd kind of split it there so the frontend dev could handle all his needs and as the backend dev I'd just be worrying about building the API endpoints for what he needed. Inevitably you start to learn how they're building out the frontend and the frontend dev is learning how the backend works over time.

That worked out quite well for us, but there are also lots of other routes you could go.

Yeah, you were manually replacing part of the functionality that's built-in to Rails there.

I don't see anything in this code for deleting authors, just adding new ones so that's part of the problem.

Posted in Deploy Ubuntu 18.04 Bionic Beaver Discussion

It definitely works with Lightsail, but we can't help you if you don't explain what you're having trouble with.

Posted in Install Bootstrap with Webpack with Rails 6 Beta


Hey Nino,

Editing requires the id of the record to be in the form so it knows which record to edit. You've got _destroy, but not id so it wouldn't know how to delete those either.. You want it as a hidden field and permitted params.

    <%= form.hidden_field :id %>

Posted in Screencast requests: Global ID and @mentions

Hey Marc!

Not sure if you missed it in the episode but thats exactly how ActionText works. It uses signed global IDs to load models and it does all that automatically for you so theres nothing you need to build.

To query, you would probably need to make an adjustment since the signed global id does not have a readable value stored in the db. May just want to add a join table between the models and add references during save.

Make sure you import Trix in your JS.

Posted in denial of service attack

I would highly recommend for DDoS protection. You'll want to set it up well before you expect to get attacked so it can protect your server IPs.

Posted in Rails credentials returning nil

I've not looked into this myself yet.

If you have scoped credentials, would you just need to access them directly without the environment since it knows which environment by the filename? Have you tried this:


Which would load the secret_key_base from the development credentials file.

Posted in Rails credentials returning nil

Hey Nino,

Maybe this is related to Rails scoping credentials to the environment again?

Posted in User Referral Program From Scratch Discussion

Hey Ignacio,

If you look through the logs above, did it fail when installing webpacker?

Hey Joel!

I think it's because of your render method. When you render json: it's going to call the to_json method on what you pass in, not render the template.

Change that to the following and you should be fine. Basically we just want to do the query in the controller and give the variable a better name. Then Rails will know to render index.json.jbuilder when the request comes in with .json at the end.

def index
  @users = User.all

And accordingly, change your index.json.jbuilder file to use the @users variable to match what was set in the action.

json.array! @users do |user|

Posted in Rubu auth without gems

Hey Ivan,

I haven't covered this yet on GoRails, but I should. This is a good tutorial to follow if you want to build auth from scratch.

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.