Skip to content
This repository
Browse code

Merge pull request #8887 from rwz/controller-scaffold-codestyle

Controller scaffold codestyle
  • Loading branch information...
commit 563ebedba34cffca738aac40e36d829e5314d405 2 parents 2d75d6f + cca1729
Rafael Mendonça França authored January 10, 2013
2  railties/lib/rails/generators/rails/scaffold/scaffold_generator.rb
@@ -10,7 +10,7 @@ class ScaffoldGenerator < ResourceGenerator # :nodoc:
10 10
       class_option :stylesheet_engine, desc: "Engine for Stylesheets"
11 11
 
12 12
       def handle_skip
13  
-        @options = @options.merge(stylesheet_engine: false) if !options[:stylesheets]
  13
+        @options = @options.merge(stylesheet_engine: false) unless options[:stylesheets]
14 14
       end
15 15
 
16 16
       hook_for :scaffold_controller, required: true
4  railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
@@ -31,7 +31,7 @@ def create
31 31
     if @<%= orm_instance.save %>
32 32
       redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully created.'" %>
33 33
     else
34  
-      render action: "new"
  34
+      render action: 'new'
35 35
     end
36 36
   end
37 37
 
@@ -40,7 +40,7 @@ def update
40 40
     if @<%= orm_instance.update("#{singular_table_name}_params") %>
41 41
       redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %>
42 42
     else
43  
-      render action: "edit"
  43
+      render action: 'edit'
44 44
     end
45 45
   end
46 46
 
2  railties/test/generators/scaffold_controller_generator_test.rb
@@ -162,7 +162,7 @@ def self.all(klass)
162 162
   def test_new_hash_style
163 163
     run_generator
164 164
     assert_file "app/controllers/users_controller.rb" do |content|
165  
-      assert_match(/render action: "new"/, content)
  165
+      assert_match(/render action: 'new'/, content)
166 166
     end
167 167
   end
168 168
 end

0 notes on commit 563ebed

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