Method: Sequel::Postgres::JSONBOp#insert

Defined in:
lib/sequel/extensions/pg_json_ops.rb

#insert(path, other, insert_after = false) ⇒ Object

Inserts the given jsonb value at the given path in the receiver. The default is to insert the value before the given path, but insert_after can be set to true to insert it after the given path.

jsonb_op.insert(['a', 'b'], h) # jsonb_insert(jsonb, ARRAY['a', 'b'], h, false)
jsonb_op.insert(['a', 'b'], h, true) # jsonb_insert(jsonb, ARRAY['a', 'b'], h, true)
[View source]

658
659
660
# File 'lib/sequel/extensions/pg_json_ops.rb', line 658

def insert(path, other, insert_after=false)
  self.class.new(function(:insert, wrap_input_array(path), wrap_input_jsonb(other), insert_after))
end