Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding create_insert method

  • Loading branch information...
commit aca58b2360f7459623499018e0a19febac926267 1 parent 83d045d
@tenderlove tenderlove authored
Showing with 12 additions and 1 deletion.
  1. +1 −0  History.txt
  2. +5 −1 lib/arel/crud.rb
  3. +6 −0 test/test_select_manager.rb
View
1  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.
View
6 lib/arel/crud.rb
@@ -32,11 +32,15 @@ def update values
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
6 test/test_select_manager.rb
@@ -483,6 +483,12 @@ def test_join_sources
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'
Please sign in to comment.
Something went wrong with that request. Please try again.