Method: Bmg::Sequel::Relation#insert

Defined in:
lib/bmg/sequel/relation.rb

#insert(arg) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/bmg/sequel/relation.rb', line 26

def insert(arg)
  case arg
  when Hash then
    dataset.insert(arg.merge(type.predicate.constants))
  when Enumerable then
    dataset.multi_insert(arg.map { |x|
      x.merge(type.predicate.constants)
    })
  else
    dataset.insert(arg.merge(type.predicate.constants))
  end
end