Rails 2 -- Load Gems based on the environment
Like rails 3, do we have a functionality of loading specific gems according to the application environment.
rails 3 example
group :production do
gem "activemerchant"
end
do we have anything similar to th开发者_开发问答e above code in rails2
Thanks in Advance.
Define the gems in the appropriate environment files.
So instead of having them all defined in environment.rb
, define the ones you want in development.rb
and production.rb
etc.
# development.rb
config.gem 'sqlite3'
# production.rb
config.gem 'mysql'
if you don't want to use different files for different environments then you can use:
if Rails.env.production?
config.gem 'activemerchant'
end
精彩评论