aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/crud.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-12-02 14:31:37 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-02 14:31:37 -0800
commita8521641d5d7630bba7620ce42fe7456eeff0398 (patch)
tree993c09a375fe57ac4210ed2ccc58f018d399a72e /lib/arel/crud.rb
parentbaa660f62b4fae9197d7b4b6e4bbcf4059d106a8 (diff)
downloadrails-a8521641d5d7630bba7620ce42fe7456eeff0398.tar.gz
rails-a8521641d5d7630bba7620ce42fe7456eeff0398.tar.bz2
rails-a8521641d5d7630bba7620ce42fe7456eeff0398.zip
deprecating the update method in favor of compile_update
Diffstat (limited to 'lib/arel/crud.rb')
-rw-r--r--lib/arel/crud.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/arel/crud.rb b/lib/arel/crud.rb
index 8de008c09e..06883d9ac6 100644
--- a/lib/arel/crud.rb
+++ b/lib/arel/crud.rb
@@ -2,8 +2,7 @@ module Arel
###
# FIXME hopefully we can remove this
module Crud
- # FIXME: this method should go away
- def update values
+ def compile_update values
um = UpdateManager.new @engine
if Nodes::SqlLiteral === values
@@ -16,7 +15,19 @@ module Arel
um.take @ast.limit
um.order(*@ast.orders)
um.wheres = @ctx.wheres
+ um
+ end
+
+ # FIXME: this method should go away
+ def update values
+ if $VERBOSE
+ warn <<-eowarn
+update (#{caller.first}) is deprecated and will be removed in ARel 2.2.0. Please
+switch to `compile_update`
+ eowarn
+ end
+ um = compile_update values
@engine.connection.update um.to_sql, 'AREL'
end