From 2549a3b088de14c36d60de6c60c1374af75c326f Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sat, 12 Jan 2013 10:52:13 -0200 Subject: Deprecate `Rails::Generators::ActiveModel#update_attributes` Deprecate #update_attributes in favor of `#update`. ORMs that implement `Generators::ActiveModel#update_attributes` should change to `#update`. Scaffold controller generators should change calls like: @orm_instance.update_attributes(...) to: @orm_instance.update(...) This goes along with the addition of `ActiveRecord::Base#update`, introduced in cb2bd4aa619d9329c42aaf6d9f8eacc616ce53f4. --- railties/lib/rails/generators/active_model.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'railties/lib') diff --git a/railties/lib/rails/generators/active_model.rb b/railties/lib/rails/generators/active_model.rb index 6183944bb0..e5373704d7 100644 --- a/railties/lib/rails/generators/active_model.rb +++ b/railties/lib/rails/generators/active_model.rb @@ -1,3 +1,5 @@ +require 'active_support/deprecation' + module Rails module Generators # ActiveModel is a class to be implemented by each ORM to allow Rails to @@ -63,6 +65,12 @@ module Rails "#{name}.update(#{params})" end + def update_attributes(*args) # :nodoc: + ActiveSupport::Deprecation.warn("Calling '@orm_instance.update_attributes' " \ + "is deprecated, please use '@orm_instance.update' instead.") + update(*args) + end + # POST create # PATCH/PUT update def errors -- cgit v1.2.3