diff options
Diffstat (limited to 'railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb')
-rw-r--r-- | railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb b/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb index 4959674976..9aa33e472e 100644 --- a/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb +++ b/railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb @@ -2,7 +2,7 @@ class <%= controller_class_name %>Controller < ApplicationController <% unless suffix -%> def index list - render_action 'list' + render :action => 'list' end <% end -%> @@ -16,7 +16,7 @@ class <%= controller_class_name %>Controller < ApplicationController end def show<%= suffix %> - @<%= singular_name %> = <%= model_name %>.find(@params[:id]) + @<%= singular_name %> = <%= model_name %>.find(params[:id]) end def new<%= suffix %> @@ -24,31 +24,31 @@ class <%= controller_class_name %>Controller < ApplicationController end def create<%= suffix %> - @<%= singular_name %> = <%= model_name %>.new(@params[:<%= singular_name %>]) + @<%= singular_name %> = <%= model_name %>.new(params[:<%= singular_name %>]) if @<%= singular_name %>.save - flash['notice'] = '<%= model_name %> was successfully created.' + flash[:notice] = '<%= model_name %> was successfully created.' redirect_to :action => 'list<%= suffix %>' else - render_action 'new<%= suffix %>' + render :action => 'new<%= suffix %>' end end def edit<%= suffix %> - @<%= singular_name %> = <%= model_name %>.find(@params[:id]) + @<%= singular_name %> = <%= model_name %>.find(params[:id]) end def update - @<%= singular_name %> = <%= model_name %>.find(@params[:id]) - if @<%= singular_name %>.update_attributes(@params[:<%= singular_name %>]) - flash['notice'] = '<%= model_name %> was successfully updated.' + @<%= singular_name %> = <%= model_name %>.find(params[:id]) + if @<%= singular_name %>.update_attributes(params[:<%= singular_name %>]) + flash[:notice] = '<%= model_name %> was successfully updated.' redirect_to :action => 'show<%= suffix %>', :id => @<%= singular_name %> else - render_action 'edit<%= suffix %>' + render :action => 'edit<%= suffix %>' end end def destroy<%= suffix %> - <%= model_name %>.find(@params[:id]).destroy + <%= model_name %>.find(params[:id]).destroy redirect_to :action => 'list<%= suffix %>' end end |