Method: Sequel::Plugins::ConstraintValidations.configure
- Defined in:
- lib/sequel/plugins/constraint_validations.rb
.configure(model, opts = OPTS) ⇒ Object
Parse the constraint validations metadata from the database. Options:
- :constraint_validations_table
-
Override the name of the constraint validations metadata table. Should only be used if the table name was overridden when creating the constraint validations.
- :validation_options
-
Override/augment the options stored in the database with the given options. Keys should be validation type symbols (e.g. :presence) and values should be hashes of options specific to that validation type.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/sequel/plugins/constraint_validations.rb', line 58 def self.configure(model, opts=OPTS) model.instance_exec do if table = opts[:constraint_validations_table] @constraint_validations_table = table end if vos = opts[:validation_options] vos.each do |k, v| if = @constraint_validation_options[k] v = .merge(v) end @constraint_validation_options[k] = v end end parse_constraint_validations end end |