diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-21 21:23:48 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-03-21 21:23:48 -0700 |
commit | aca58b2360f7459623499018e0a19febac926267 (patch) | |
tree | 9e35aea1004538c8864318beb05b728d131f961b | |
parent | 83d045d2d8881e4310f0f54376a5e04d395f3c7a (diff) | |
download | rails-aca58b2360f7459623499018e0a19febac926267.tar.gz rails-aca58b2360f7459623499018e0a19febac926267.tar.bz2 rails-aca58b2360f7459623499018e0a19febac926267.zip |
adding create_insert method
-rw-r--r-- | History.txt | 1 | ||||
-rw-r--r-- | lib/arel/crud.rb | 6 | ||||
-rw-r--r-- | test/test_select_manager.rb | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/History.txt b/History.txt index a5f630b021..9c0d3198a1 100644 --- a/History.txt +++ b/History.txt @@ -9,6 +9,7 @@ * Add Arel::SelectManager#limit= * Add Arel::SelectManager#offset * Add Arel::SelectManager#offset= + * Added Arel::SelectManager#create_insert for building an insert manager. * Math operations have been added to attributes, thanks to Vladimir Meremyanin. diff --git a/lib/arel/crud.rb b/lib/arel/crud.rb index bedfb8c30c..43805dd464 100644 --- a/lib/arel/crud.rb +++ b/lib/arel/crud.rb @@ -32,11 +32,15 @@ switch to `compile_update` end def compile_insert values - im = InsertManager.new @engine + im = create_insert im.insert values im end + def create_insert + InsertManager.new @engine + end + # FIXME: this method should go away def insert values if $VERBOSE diff --git a/test/test_select_manager.rb b/test/test_select_manager.rb index 410fe38e2a..3eec73a1f0 100644 --- a/test/test_select_manager.rb +++ b/test/test_select_manager.rb @@ -483,6 +483,12 @@ module Arel assert_equal children, clause.children end + it 'should create insert managers' do + relation = Arel::SelectManager.new Table.engine + insert = relation.create_insert + assert_kind_of Arel::InsertManager, insert + end + it 'should create join nodes' do relation = Arel::SelectManager.new Table.engine join = relation.create_join 'foo', 'bar' |