Class: GaggedValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/ball_gag/validations.rb

Direct Known Subclasses

NotGaggedValidator

Instance Method Summary collapse

Instance Method Details

#validate_each(object, attribute, value) ⇒ Object



2
3
4
5
6
# File 'lib/ball_gag/validations.rb', line 2

def validate_each object, attribute, value
  unless object.method(condition_method_name(attribute)).call
    object.errors[attribute] << (options[:message] || default_message)
  end
end