RailsCasts Pro episodes are now free!

Learn more or hide this

Brandon Beacher's Profile

GitHub User: brandon-beacher

Site: thewildwildrest.com

Comments by Brandon Beacher


I needed a:

ENV["QC_DATABASE_URL"] = "postgres://localhost/mailer_development" if Rails.env.development?

instead of:

ENV["DATABASE_URL"] = "postgres://localhost/mailer_development"

in config/initializers/queue_classic.rb

The two differences:

1) Only set the url in development so when I deploy to Heroku the production database url gets picked up.

2) Use QC_DATABASE_URL instead of DATABASE_URL. Apparently Rails actually uses DATABASE_URL instead of database.yml if DATABASE_URL is present. This will cause your tests to start failing, despite the Rails.env.development? guard, due to the initializer running prior to Rails.env getting set to "test". This is confusing, but put a puts Rails.env into the initializer and watch the output when you run rake test and you'll see "development" and then "test" as Rails runs your tests.

Hope that helps someone. Great Railscast as always Ryan!