RailsCasts Pro episodes are now free!

Learn more or hide this

Matthew Lehner's Profile

GitHub User: matthewlehner

Site: http://matthewlehner.net

Comments by Matthew Lehner

Avatar

I've been playing with this setting and have run into a bit of a gotcha.

tl;dr - models don't load in rake tasks/migrations - do this:
config.threadsafe! unless $rails_rake_task or explicitly require the model.

The dependency_loading = false setting in the threadsafe! method means that you won't have access to your models in migrations or rake tasks (ie. db:seed).

It's described here this old rails issue and discussed in this article.