Class/Module Index [+]

Quicksearch

Sequel::SetOverrides

Public Instance Methods

set_defaults(hash) click to toggle source

Set the default values for insert and update statements. The values hash passed to insert or update are merged into this hash, so any values in the hash passed to insert or update will override values passed to this method.

DB[:items].set_defaults(:a=>'a', :c=>'c').insert(:a=>'d', :b=>'b')
# INSERT INTO items (a, c, b) VALUES ('d', 'c', 'b')
# File lib/sequel/extensions/set_overrides.rb, line 27
def set_defaults(hash)
  clone(:defaults=>(@opts[:defaults]||{}).merge(hash))
end
set_overrides(hash) click to toggle source

Set values that override hash arguments given to insert and update statements. This hash is merged into the hash provided to insert or update, so values will override any values given in the insert/update hashes.

DB[:items].set_overrides(:a=>'a', :c=>'c').insert(:a=>'d', :b=>'b')
# INSERT INTO items (a, c, b) VALUES ('a', 'c', 'b')
# File lib/sequel/extensions/set_overrides.rb, line 37
def set_overrides(hash)
  clone(:overrides=>hash.merge(@opts[:overrides]||{}))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.