Chris Oliver

Joined

291,230 Experience
86 Lessons Completed
296 Questions Solved

Activity

You may not want / need that to be accessible by everyone, in which case you don't want to add it to the ActiveRecord class, just the association.

Posted in Dynamic Single Table Inheritance with Rails Discussion

Maybe we'll start a new series on metaprogramming. 👍

Posted in Amazon S3 in blog tutorial error

Make sure you added the credentials to the right credentials file (using rails credentials:edit --environment development) and that you've added it to all of the ones you need.

You can also open up the Rails console and use Rails.application.credentials to confirm they're loaded properly.

Posted in Dynamic Single Table Inheritance with Rails Discussion

You can either check the class with is_a? or check methods if with respond_to?

Posted in Components with Phlex in Rails Discussion

No different than html.erb views. Both just generate the HTML independently of the JavaScript.

Posted in Components with Phlex in Rails Discussion

I feel like components in Ruby are super duper handy for arguments and other complex helper methods. Phlex takes it a step further with the HTML helper methods so you don't even really have to leave Ruby while you're coding. Pretty cool stuff!

Posted in Anyone using Litestack + SQLite in Production

I'm not sure if anyone's using Litestack, but SQLite is ready to go. You'll just want to set the SQLite database location to the shared directory so it isn't lost between deploys. I think Rails has changed it's default location to /storage which is automatically symlinked on deploy (just make sure the folder is not in your repo), so it may be good to go as-is.

Posted in Template Locals in Rails 7.1 Discussion

That should work but let me know if it doesn't!

Posted in How to use Mission Control Jobs in Rails Discussion

Yeah, Puma is the Rails default.

Posted in How to use Mission Control Jobs in Rails Discussion

Super excited to see Mission Control out in the wild. It's a dashboard for ActiveJob that works across queue adapters. What's nice is that in the long term you can swap out backends but still have the same UI for monitoring and retrying jobs.

Posted in Dynamic Single Table Inheritance with Rails Discussion

This was really fun. I wanted an easy way to introduce helpers to Notifications so by exposing them also as STI models, we could make them easily accessible with separate helper methods for each Notifier type. Super cool how flexible Ruby is for allowing these types of solutions!

Posted in What's New In Ruby 3.3 Discussion

ASDF users use an env var to use the latest ruby-build:

ASDF_RUBY_BUILD_VERSION=master asdf install ruby 3.3.0

Posted in What's New In Ruby 3.3 Discussion

Probably today.

Posted in What's New In Ruby 3.3 Discussion

Happy Holidays and New Year everyone! 🥳

Depends on if you're using those features, but you might still want Redis. There is also a PostgreSQL adapter you can use for ActionCable as well.

Yep, just call it "jobs:" because web would be the name for the Rails server.

Yeah, that's an excellent point about Heroku! So long as memory usage is can live inside the dyno safely I guess.

You can setup Solid Queue to use a separate database by defining this config which will be applied to all the SolidQueue models.

# Use a separate DB for Solid Queue
config.solid_queue.connects_to = { database: { writing: :solid_queue_primary, reading: :solid_queue_replica } }

Please share what the actual issues are, otherwise we can't help much. 👍

Posted in Rails 7.1 Authentication From Scratch - Test Helpers

For controller & integration tests, you'll make a POST request to log the user in:

class ActiveSupport::TestCase
  def login(user, password: "password")
    post login_path, params: {
      email: user.email,
      password: password
    }
  end
end