diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-13 13:20:45 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-13 13:20:45 -0800 |
commit | 761b0d98f7374c50f1256ff2b4c25c6c843dba4b (patch) | |
tree | 6d58d646a142ffd1381fe42ab5766e9f22136975 /lib | |
parent | 99ae19edd38e5cbb87e827dd28607d3b1cbbb0b7 (diff) | |
download | rails-761b0d98f7374c50f1256ff2b4c25c6c843dba4b.tar.gz rails-761b0d98f7374c50f1256ff2b4c25c6c843dba4b.tar.bz2 rails-761b0d98f7374c50f1256ff2b4c25c6c843dba4b.zip |
deprecating SelectManager#insert
Diffstat (limited to 'lib')
-rw-r--r-- | lib/arel/select_manager.rb | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb index 372b6aae6f..1100c29f20 100644 --- a/lib/arel/select_manager.rb +++ b/lib/arel/select_manager.rb @@ -180,13 +180,22 @@ module Arel # FIXME: this method should go away def insert values - im = InsertManager.new @engine + if $VERBOSE + warn <<-eowarn +insert (#{caller.first}) is deprecated and will be removed in ARel 3.0.0. Please +switch to `compile_insert` + eowarn + end + + im = compile_insert(values) table = @ctx.froms - primary_key_name = (primary_key = table.primary_key) && primary_key.name + + primary_key = table.primary_key + primary_key_name = primary_key.name if primary_key + # FIXME: in AR tests values sometimes were Array and not Hash therefore is_a?(Hash) check is added primary_key_value = primary_key && values.is_a?(Hash) && values[primary_key] im.into table - im.insert values # Oracle adapter needs primary key name to generate RETURNING ... INTO ... clause # for tables which assign primary key value using trigger. # RETURNING ... INTO ... clause will be added only if primary_key_value is nil |