diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-13 15:49:26 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-13 15:49:26 +0000 |
commit | 52251baae48cf25ea06106569af3d04c76841210 (patch) | |
tree | ea55860662c17325bd077e231583326f37872d26 /railties/generators/scaffold/templates/controller.rb | |
parent | 9c09f81bc6bc08122e2835fb59e66d80751bd058 (diff) | |
download | rails-52251baae48cf25ea06106569af3d04c76841210.tar.gz rails-52251baae48cf25ea06106569af3d04c76841210.tar.bz2 rails-52251baae48cf25ea06106569af3d04c76841210.zip |
Added the option to specify a controller name to "generate scaffold" and made the default controller name the plural form of the model.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@404 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/generators/scaffold/templates/controller.rb')
-rw-r--r-- | railties/generators/scaffold/templates/controller.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/railties/generators/scaffold/templates/controller.rb b/railties/generators/scaffold/templates/controller.rb index 15ade4c49b..7ccb517bee 100644 --- a/railties/generators/scaffold/templates/controller.rb +++ b/railties/generators/scaffold/templates/controller.rb @@ -1,6 +1,4 @@ -class <%= class_name %>Controller < ApplicationController - layout 'scaffold' - +class <%= @controller_class_name %>Controller < ApplicationController <% unless suffix -%> def index list @@ -41,8 +39,7 @@ class <%= class_name %>Controller < ApplicationController def update @<%= singular_name %> = <%= class_name %>.find(@params['<%= singular_name %>']['id']) - @<%= singular_name %>.attributes = @params['<%= singular_name %>'] - if @<%= singular_name %>.save + if @<%= singular_name %>.update_attributes(@params['<%= singular_name %>']) flash['notice'] = '<%= class_name %> was successfully updated.' redirect_to :action => 'show<%= suffix %>', :id => @<%= singular_name %>.id else |