From 32c0e895bfa521acdc5c7031a2285a3b8dd53130 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Thu, 2 Jun 2005 20:13:02 +0000 Subject: Fixed scaffolding to use the latest style git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1380 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../components/scaffold/templates/controller.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'railties/lib/rails_generator/generators/components/scaffold/templates/controller.rb') 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 -- cgit v1.2.3