Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Controller scaffold codestyle #8887

Merged
merged 2 commits into from

2 participants

@rwz

Small codestyle changes from my branch that DHH reimplemented. :)

@rafaelfranca rafaelfranca merged commit 563ebed into rails:master
@rwz rwz deleted the unknown repository branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 11, 2013
  1. @rwz

    Changed if ! to unless

    rwz authored
  2. @rwz
This page is out of date. Refresh to see the latest.
View
2  railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb
@@ -10,7 +10,7 @@ class ScaffoldGenerator < ResourceGenerator # :nodoc:
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
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 action: '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 action: 'edit'
end
end
View
2  railties/test/generators/scaffold_controller_generator_test.rb
@@ -162,7 +162,7 @@ def self.all(klass)
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
Something went wrong with that request. Please try again.