Module: ValidatesDecencyOf::ClassMethods
- Defined in:
- lib/validates_decency_of.rb,
lib/validates_decency_of.rb
Instance Method Summary collapse
Instance Method Details
#validates_decency_of(*attr_names) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/validates_decency_of.rb', line 25 def validates_decency_of(*attribute_names) = { :message => 'is indecent' } .merge!(attribute_names.pop) if attribute_names.last.kind_of?(Hash) .merge! :on => :save validates_each(attribute_names, ) do |record, attribute_name, value| record.errors.add attribute_name, [:message] if ValidatesDecencyOf.indecent? value end end |