aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-12-02 14:01:08 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-02 14:01:08 -0800
commitbaa660f62b4fae9197d7b4b6e4bbcf4059d106a8 (patch)
tree9757fa9803cd4035450f2efe1196cfa8afd4f875 /lib
parent39ccb8049c87b1fde1b85c6a0d84e0f72e92bac1 (diff)
downloadrails-baa660f62b4fae9197d7b4b6e4bbcf4059d106a8.tar.gz
rails-baa660f62b4fae9197d7b4b6e4bbcf4059d106a8.tar.bz2
rails-baa660f62b4fae9197d7b4b6e4bbcf4059d106a8.zip
deprecating "insert"
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/crud.rb16
-rw-r--r--lib/arel/table.rb4
2 files changed, 17 insertions, 3 deletions
diff --git a/lib/arel/crud.rb b/lib/arel/crud.rb
index b3199e6d38..8de008c09e 100644
--- a/lib/arel/crud.rb
+++ b/lib/arel/crud.rb
@@ -20,11 +20,21 @@ module Arel
@engine.connection.update um.to_sql, 'AREL'
end
- # FIXME: this method should go away
- def insert values
+ def compile_insert values
im = InsertManager.new @engine
im.insert values
- @engine.connection.insert im.to_sql
+ im
+ end
+
+ # FIXME: this method should go away
+ def insert values
+ if $VERBOSE
+ warn <<-eowarn
+insert (#{caller.first}) is deprecated and will be removed in ARel 2.2.0. Please
+switch to `compile_insert`
+ eowarn
+ end
+ @engine.connection.insert compile_insert(values).to_sql
end
def delete
diff --git a/lib/arel/table.rb b/lib/arel/table.rb
index aa23a7d601..ca811debee 100644
--- a/lib/arel/table.rb
+++ b/lib/arel/table.rb
@@ -108,6 +108,10 @@ module Arel
SelectManager.new(@engine)
end
+ def insert_manager
+ InsertManager.new(@engine)
+ end
+
private
def attributes_for columns