Permalink
Browse files

Fix syntax error in controller template

  • Loading branch information...
1 parent 7b5d466 commit e738acd08052c73cd5b52cd8c706f6982ba1ca8c @guilleiguaran guilleiguaran committed Dec 23, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb
@@ -12,7 +12,9 @@ def index
@<%= 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 @@ def index
# 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 @@ def create
<%- 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 @@ def destroy
@<%= 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

0 comments on commit e738acd

Please sign in to comment.