diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-18 10:00:08 -0700 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-07-18 10:00:08 -0700 |
commit | 8efc0f1f340ef50362b87d428ebff85a2f66cb16 (patch) | |
tree | 312d09c04c2fed26820602730a79b2a2edb8171b /railties/lib/rails | |
parent | da144894e958770c84692065ec260aea2853afe9 (diff) | |
parent | fcdcc87a0890158046a2358f0a668a5157c38b3d (diff) | |
download | rails-8efc0f1f340ef50362b87d428ebff85a2f66cb16.tar.gz rails-8efc0f1f340ef50362b87d428ebff85a2f66cb16.tar.bz2 rails-8efc0f1f340ef50362b87d428ebff85a2f66cb16.zip |
Merge pull request #2116 from guilleiguaran/fix-environment-generator-action
Fix Rails::Generators::Actions#environment when env is passed
Diffstat (limited to 'railties/lib/rails')
-rw-r--r-- | railties/lib/rails/generators/actions.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index 433a56dc57..b8541c236e 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -92,14 +92,15 @@ module Rails # def environment(data=nil, options={}, &block) sentinel = /class [a-z_:]+ < Rails::Application/i + env_file_sentinel = /::Application\.configure do/ data = block.call if !data && block_given? in_root do if options[:env].nil? inject_into_file 'config/application.rb', "\n #{data}", :after => sentinel, :verbose => false else - Array.wrap(options[:env]).each do|env| - append_file "config/environments/#{env}.rb", "\n#{data}", :verbose => false + Array.wrap(options[:env]).each do |env| + inject_into_file "config/environments/#{env}.rb", "\n #{data}", :after => env_file_sentinel, :verbose => false end end end |