Module: ArelExtensions::InsertManager
- Defined in:
- lib/arel_extensions/insert_manager.rb
Defined Under Namespace
Classes: BulkValues
Instance Method Summary collapse
Instance Method Details
#bulk_insert(cols, data) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/arel_extensions/insert_manager.rb', line 6 def bulk_insert(cols, data) case cols.first when String, Symbol cols.each { |c| @ast.columns << @ast.relation[c] } when Array if String === cols.first.first @ast.columns = cols.map {|c| [@ast.relation[c.first]] } elsif Arel::Attributes::Attribute == cols.first.first @ast.columns = cols end when NilClass @ast.columns = @ast.relation.columns end self.values = BulkValues.new(@ast.columns, data) end |