mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #8887 from rwz/controller-scaffold-codestyle
Controller scaffold codestyle
This commit is contained in:
commit
563ebedba3
3 changed files with 4 additions and 4 deletions
|
@ -10,7 +10,7 @@ module Rails
|
|||
class_option :stylesheet_engine, desc: "Engine for Stylesheets"
|
||||
|
||||
def handle_skip
|
||||
@options = @options.merge(stylesheet_engine: false) if !options[:stylesheets]
|
||||
@options = @options.merge(stylesheet_engine: false) unless options[:stylesheets]
|
||||
end
|
||||
|
||||
hook_for :scaffold_controller, required: true
|
||||
|
|
|
@ -31,7 +31,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|||
if @<%= orm_instance.save %>
|
||||
redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully created.'" %>
|
||||
else
|
||||
render action: "new"
|
||||
render action: 'new'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,7 +40,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|||
if @<%= orm_instance.update("#{singular_table_name}_params") %>
|
||||
redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %>
|
||||
else
|
||||
render action: "edit"
|
||||
render action: 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
|
|||
def test_new_hash_style
|
||||
run_generator
|
||||
assert_file "app/controllers/users_controller.rb" do |content|
|
||||
assert_match(/render action: "new"/, content)
|
||||
assert_match(/render action: 'new'/, content)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue