Skip to content
Browse files

Use short-form for the scaffold render calls and drop the needless test

  • Loading branch information...
1 parent ce7e3d5 commit 1fba21aa175c5013655ef033865abfaec77618a7 @dhh dhh committed Apr 8, 2014
View
4 railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
@@ -31,7 +31,7 @@ def create
if @<%= orm_instance.save %>
redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully created.'" %>
else
- render action: 'new'
+ render :new
end
end
@@ -40,7 +40,7 @@ def update
if @<%= orm_instance.update("#{singular_table_name}_params") %>
redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %>
else
- render action: 'edit'
+ render :edit
end
end
View
7 railties/test/generators/scaffold_controller_generator_test.rb
@@ -160,13 +160,6 @@ def self.all(klass)
Unknown::Generators.send :remove_const, :ActiveModel
end
- def test_new_hash_style
- run_generator
- assert_file "app/controllers/users_controller.rb" do |content|
- assert_match(/render action: 'new'/, content)
- end
- end
-
def test_model_name_option
run_generator ["Admin::User", "--model-name=User"]
assert_file "app/controllers/admin/users_controller.rb" do |content|

0 comments on commit 1fba21a

Please sign in to comment.
Something went wrong with that request. Please try again.