diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 8 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/application.rb | 8 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 1 |
3 files changed, 11 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 3d16304d86..e8709b2ddd 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -120,6 +120,14 @@ module Rails options[:skip_active_record] ? "" : "gem '#{gem_for_database}'\n" end + def include_all_railties? + !options[:skip_active_record] && !options[:skip_test_unit] + end + + def comment_if(value) + options[value] ? '#' : '' + end + def rails_gemfile_entry if options.dev? <<-GEMFILE.strip_heredoc diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb b/railties/lib/rails/generators/rails/app/templates/config/application.rb index 430468afb4..e1946807b0 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/application.rb +++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb @@ -1,14 +1,14 @@ require File.expand_path('../boot', __FILE__) -<% if !options[:skip_active_record] && !options[:skip_test_unit] -%> +<% if include_all_railties? -%> require 'rails/all' <% else -%> # Pick the frameworks you want: -<%= options[:skip_active_record] ? "#" : "" %> require "active_record/railtie" +<%= comment_if :skip_active_record %> require "active_record/railtie" require "action_controller/railtie" require "action_mailer/railtie" require "active_resource/railtie" -<%= options[:skip_test_unit] ? "#" : "" %> require "rails/test_unit/railtie" +<%= comment_if :skip_test_unit %> require "rails/test_unit/railtie" <% end -%> # If you have a Gemfile, require the gems listed there, including any gems @@ -59,8 +59,6 @@ module <%= app_const_base %> <% unless options[:skip_active_record] -%> # Enable IdentityMap for Active Record, to disable set to false or remove the line below. config.active_record.identity_map = true -<% else -%> - config.generators.orm = false <% end -%> # Enable the asset pipeline diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 327b758a61..4bcbf4a90c 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -163,7 +163,6 @@ class AppGeneratorTest < Rails::Generators::TestCase run_generator [destination_root, "--skip-active-record"] assert_file "config/application.rb" do |file| assert_match /#\s+require\s+["']active_record\/railtie["']/, file - assert_match /config.generators.orm = false/, file end end |