diff options
author | Guillermo Iguaran <guilleiguaran@gmail.com> | 2011-07-17 01:47:21 -0500 |
---|---|---|
committer | Guillermo Iguaran <guilleiguaran@gmail.com> | 2011-07-18 10:43:25 -0500 |
commit | fcdcc87a0890158046a2358f0a668a5157c38b3d (patch) | |
tree | 311e3ffa664cc99d61894692c788f69e6235dbbb /railties/lib/rails/generators/actions.rb | |
parent | 0aec2e7191b8845fda9a2bbe3d76c6a9dc22401b (diff) | |
download | rails-fcdcc87a0890158046a2358f0a668a5157c38b3d.tar.gz rails-fcdcc87a0890158046a2358f0a668a5157c38b3d.tar.bz2 rails-fcdcc87a0890158046a2358f0a668a5157c38b3d.zip |
Fix Rails::Generators::Actions#environment when env is passed. Closes #2110
Diffstat (limited to 'railties/lib/rails/generators/actions.rb')
-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 |