aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2012-12-22 23:46:51 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2012-12-22 23:46:51 -0500
commite738acd08052c73cd5b52cd8c706f6982ba1ca8c (patch)
treed923db97d5a88f277cc0d32401899d4826977f69 /railties/lib/rails/generators
parent7b5d466faffa98fb8b277be0f6fa6c6e5df4bb64 (diff)
downloadrails-e738acd08052c73cd5b52cd8c706f6982ba1ca8c.tar.gz
rails-e738acd08052c73cd5b52cd8c706f6982ba1ca8c.tar.bz2
rails-e738acd08052c73cd5b52cd8c706f6982ba1ca8c.zip
Fix syntax error in controller template
Diffstat (limited to 'railties/lib/rails/generators')
-rw-r--r--railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
index 8f2967bc61..999a29b18d 100644
--- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
+++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
@@ -12,7 +12,9 @@ class <%= controller_class_name %>Controller < ApplicationController
@<%= plural_table_name %> = <%= orm_class.all(class_name) %>
respond_to do |format|
- <%- if options[:html] -%>format.html # index.html.erb<%- end -%>
+ <%- if options[:html] -%>
+ format.html # index.html.erb
+ <%- end -%>
format.json { render json: <%= "@#{plural_table_name}" %> }
end
end
@@ -21,7 +23,9 @@ class <%= controller_class_name %>Controller < ApplicationController
# GET <%= route_url %>/1.json
def show
respond_to do |format|
- <%- if options[:html] -%>format.html # show.html.erb<%- end -%>
+ <%- if options[:html] -%>
+ format.html # show.html.erb
+ <%- end -%>
format.json { render json: <%= "@#{singular_table_name}" %> }
end
end
@@ -55,7 +59,9 @@ class <%= controller_class_name %>Controller < ApplicationController
<%- end -%>
format.json { render json: <%= "@#{singular_table_name}" %>, status: :created, location: <%= "@#{singular_table_name}" %> }
else
- <%- if options[:html] -%>format.html { render action: "new" }<%- end -%>
+ <%- if options[:html] -%>
+ format.html { render action: "new" }
+ <%- end -%>
format.json { render json: <%= "@#{orm_instance.errors}" %>, status: :unprocessable_entity }
end
end
@@ -83,7 +89,9 @@ class <%= controller_class_name %>Controller < ApplicationController
@<%= orm_instance.destroy %>
respond_to do |format|
- <%- if options[:html] -%>format.html { redirect_to <%= index_helper %>_url }<%- end -%>
+ <%- if options[:html] -%>
+ format.html { redirect_to <%= index_helper %>_url }
+ <%- end -%>
format.json { head :no_content }
end
end