1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

adding create_insert method

This commit is contained in:
Aaron Patterson 2011-03-21 21:23:48 -07:00
parent 83d045d2d8
commit aca58b2360
3 changed files with 12 additions and 1 deletions

View file

@ -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.

View file

@ -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

View file

@ -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'