Chris Oliver

Joined

292,890 Experience
93 Lessons Completed
295 Questions Solved

Activity

Hey zino,

A text column should work just fine. Rails will escape strings by default, which is what it will think it is given it's a text column.

When you render it out, you'll need to make sure it's rendered as raw values instead of as a string.

Something like <%= @record.column.html_safe %> which would flag it as safe string to render directly without escaping.

The exact way you do that in your response will depend a bit upon which library you're using to render the JSON response, but that's the gist of it.

Posted in New Site Design!

Thanks Nick and Erik! I spent all weekend building it and am really happy with how it turned out.

If you guys notice any bugs, let me know! I think I had to edit almost every single view so I'm sure I missed something here or there.

Posted in Rails Application Templates Discussion

You'll have to view the Rails logs on Heroku, not the HTTP logs, to find the actual error.

Absolutely unacceptable Nick.

🤣 Just teasing!

If you edit the migration, you'd have to do a rollback to undo that migration and then re-run it. Obviously that'd blow away a bunch of data, so to add trackable at a later time you'll want to just create a new migration to add those columns separately.

Posted in Non-series episode list?

No idea, but sounds about right. I also just might make some new series and make sure they all land in something.

Posted in Non-series episode list?

No, but that's a good idea. Every episode can optionally belong to a series, so if you primarily used the Series page to find stuff to watch, you'd miss out on the others. Maybe I'll make a special series of un-series'd episodes or something. :)

Posted in Rails & Vue.js Trello Clone - Part 1 Discussion

It's just an install of Bootstrap and Devise, both of which I've covered in other episodes. Just search for them and you'll be up to speed!

Posted in Transcode a video and move to a remote server

You might need to build your own storage plugin for Shrine if your SMB share isn't mounted as a disk somewhere.

Posted in how do I exclude one field from being updated?

Sounds like you could simply change your form on update to set the new field and hide the old one.

Posted in Transcode a video and move to a remote server

Hey James,

Have you seen this episode? This runs transcoding in a background job after upload: https://gorails.com/episodes/shrine-background-and-video-transcoding

Posted in Nested Comment Threads in Rails - Part 1 Discussion

Yep, you certainly could. If you need those features it'd be great. Otherwise, there's not a whole lot of difference.

Hey Afolabi,

It should be as simple as using SQLs group and sum functionality. For example:

Order.where("created_at BETWEEN ? AND ?", 1.month.ago, Time.zone.now)group(:currency).sum(:charged_fee)
{"CAD"=>82, "NGN"=>20, "USD"=>143, "YEN"=>40}

Order.where("created_at BETWEEN ? AND ?", 1.month.ago, Time.zone.now)group(:currency).sum(:network_fee)
{"CAD"=>"23", "NGN"=>"40", "USD"=>"60", "YEN"=>"30"}

Posted in integrating stimulus with ruby on rails

app/javascript/controllers

It creates an example controller in there when you install stimulus with webpacker. rails webpacker:install:stimulus

Posted in Grant all privileges problem

I think maybe you're mixing commands. When you create user, you specify the password. When you grant privileges, I don't think you want the "IDENTIFIED BY PASSWORD" part.

Here's a good little blog post that explains more about it. https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

Posted in Error Tracking with Errbit Discussion

A) Yep, I use it for all my error handling. Deployed it with Hatchbox and it's on its own server. You'll just need to read up on all the ENV Vars you need to set.

B) Hmm, it's definitely not in Rails. Must have been something else we were talking about.

Great! Glad you got it working. 🙌

Posted in Integrating Braintree (and PayPal) Discussion

Usually there are 3 or 4 automatic retries on the card, and then the subscription is automatically cancelled. You'll get a webhook from Braintree for the cancellation so you can update mark the user as cancelled in your app.

Posted in Change Layout based on current URL

As a really trivial example, you can do what they mentioned on StackOverflow here: https://stackoverflow.com/questions/6748168/changing-rails-3-apps-layout-based-on-the-hostname-domain-for-branding

  layout :domain_layout

    def domain_layout
    controller.request.host
    end

Which would look for app/views/layouts/a123.mywebsite.com.html.erb, etc.

You can do other tweaks to that to decide which file to render.

Still made a GET request, so you know that your Rails UJS Javascript is broken if it's not making a DELETE request.

No route matches [GET] "/projects/1/delete_upload/2"

You made a GET request to the url, but your routes define a DELETE route.

You must add method: :delete to your link.