aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md15
-rw-r--r--railties/lib/rails/generators/active_model.rb8
2 files changed, 23 insertions, 0 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index ccb8a1fc8d..4fd1a2369f 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,5 +1,20 @@
## Rails 4.0.0 (unreleased) ##
+* Deprecate `Rails::Generators::ActiveModel#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`.
+
+ *Carlos Antonio da Silva*
+
* Include `jbuilder` by default and rely on its scaffold generator to show json API.
Check https://github.com/rails/jbuilder for more info and examples.
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