I should add that this requires that you comment out the

   config.frameworks -= [ :action_mailer ]

if you specify the rails gem in your Gemfile (meaning you are using the Rails gem, not the vendor'ed rails that ships with the Radiant gem).

For me, I have to specify the rails gem because I'm deploying to Heroku.


On 6/2/11 5:04 PM, Wes Gamble wrote:

This is really bundler stuff, but if you want to use bundler to manage gem dependencies (a la Rails 3) instead of using config.gem commands in environment.rb, here's how you do it:

1) Generate your Gemfile in Rails.root as normal and use bundle install and bundle update to manage your gems 2) Add a file named "preinitializer.rb" to Rails.root/config with the following content:

  require "rubygems"
  require "bundler"
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."

if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
  raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
   "Run `gem install bundler` to upgrade."

  # Set up load paths for all bundled gems
  ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
rescue Bundler::GemNotFound
  raise RuntimeError, "Bundler couldn't find some gems." +
    "Did you run `bundle install`?"

This will allow you to remove all of the config.gem entries from environment.rb and make it slightly easier to upgrade to Rails 3 someday.


Reply via email to