diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-04 06:50:45 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-04 10:58:53 -0300 |
commit | 927a04da40b3d9b97cb23be7c0820eee629f0f7a (patch) | |
tree | 17d973dea02611b7b120e479df7f1516843fa99e /railties | |
parent | 9d7a748a5174224ead4d44aedc3849d1d1e37b18 (diff) | |
download | rails-927a04da40b3d9b97cb23be7c0820eee629f0f7a.tar.gz rails-927a04da40b3d9b97cb23be7c0820eee629f0f7a.tar.bz2 rails-927a04da40b3d9b97cb23be7c0820eee629f0f7a.zip |
Merge pull request #10448 from arunagw/bug-fix-scaffold-generator-master
Fixes Scaffold generator with --assets=false
Conflicts:
railties/CHANGELOG.md
Conflicts:
railties/CHANGELOG.md
railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 5 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/scaffold_generator_test.rb | 14 |
3 files changed, 20 insertions, 1 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index c0ab4b8317..410afc3018 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,6 +1,9 @@ ## unreleased ## -* No changes. +* Fixes bug with scaffold generator with `--assets=false --resource-route=false`. + Fixes #9525. + + *Arun Agrawal* ## Rails 3.2.13 (Mar 18, 2013) ## diff --git a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb index 03a61a035e..353ebe93ed 100644 --- a/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb @@ -8,6 +8,8 @@ module Rails class_option :stylesheets, :type => :boolean, :desc => "Generate Stylesheets" class_option :stylesheet_engine, :desc => "Engine for Stylesheets" + class_option :assets, :type => :boolean + class_option :resource_route, :type => :boolean hook_for :scaffold_controller, :required => true diff --git a/railties/test/generators/scaffold_generator_test.rb b/railties/test/generators/scaffold_generator_test.rb index 5891af505a..92d529d9b1 100644 --- a/railties/test/generators/scaffold_generator_test.rb +++ b/railties/test/generators/scaffold_generator_test.rb @@ -276,6 +276,20 @@ class ScaffoldGeneratorTest < Rails::Generators::TestCase assert_no_file "app/assets/stylesheets/posts.css" end + def test_scaffold_generator_no_assets + run_generator [ "posts", "--assets=false" ] + assert_file "app/assets/stylesheets/scaffold.css" + assert_no_file "app/assets/javascripts/posts.js" + assert_no_file "app/assets/stylesheets/posts.css" + end + + def test_scaffold_generator_no_assets + run_generator [ "posts", "--resource-route=false" ] + assert_file "config/routes.rb" do |route| + assert_no_match(/resources :posts$/, route) + end + end + def test_scaffold_generator_no_stylesheets run_generator [ "posts", "--no-stylesheets" ] assert_no_file "app/assets/stylesheets/scaffold.css" |