I recently had a problem with rake gems:install with a fresh rails app. Rakefile bootstraps the full rails environment, including plugins, controllers, etc. Some of the code getting executed depended on a gem, but I was running “rake gem:install” to install those gems. A circular “chicken or the egg” problem!

Here was my solution, which I put in environment.rb


unless $0 =~ /rake/
 # ... require code that relies on certain gems
end

Leave a Reply