From 0433d79724fc2f97208b1e3aec43335c7c33f7cc Mon Sep 17 00:00:00 2001 From: Amparo Luna + Guillermo Iguaran Date: Wed, 2 Jan 2013 16:55:29 -0500 Subject: Updating default application templates to use update instead of update_attributes --- railties/lib/rails/generators/active_model.rb | 4 ++-- .../generators/rails/scaffold_controller/templates/controller.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/lib/rails') diff --git a/railties/lib/rails/generators/active_model.rb b/railties/lib/rails/generators/active_model.rb index 0e51b9c568..6183944bb0 100644 --- a/railties/lib/rails/generators/active_model.rb +++ b/railties/lib/rails/generators/active_model.rb @@ -59,8 +59,8 @@ module Rails end # PATCH/PUT update - def update_attributes(params=nil) - "#{name}.update_attributes(#{params})" + def update(params=nil) + "#{name}.update(#{params})" end # POST create 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 4baad85e9e..2512ce0af1 100644 --- a/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb +++ b/railties/lib/rails/generators/rails/scaffold_controller/templates/controller.rb @@ -71,7 +71,7 @@ class <%= controller_class_name %>Controller < ApplicationController # PATCH/PUT <%= route_url %>/1.json def update respond_to do |format| - if @<%= orm_instance.update_attributes("#{singular_table_name}_params") %> + if @<%= orm_instance.update("#{singular_table_name}_params") %> <%- if options[:html] -%> format.html { redirect_to @<%= singular_table_name %>, notice: <%= "'#{human_name} was successfully updated.'" %> } <%- end -%> -- cgit v1.2.3