Method: Engine2::TypeInfo#unique
- Defined in:
- lib/engine2/type_info.rb
#unique(field, *with) ⇒ Object
def validation field, name, opts = true
modify_field field do |info|
info[:validations][name] = opts
end
end
206 207 208 209 210 211 212 |
# File 'lib/engine2/type_info.rb', line 206 def unique field, *with depends_on(field, *with) modify_field field do |info| info[:transaction] = true info[:validations][:unique] = {with: with} end end |