Methods
N
S
V
Class Public methods
new(options)
# File activemodel/lib/active_model/validations/acceptance.rb, line 5
def initialize(options)
  super(options.reverse_merge(:allow_nil => true, :accept => "1"))
end
Instance Public methods
setup(klass)
# File activemodel/lib/active_model/validations/acceptance.rb, line 15
def setup(klass)
  attr_readers = attributes.reject { |name| klass.attribute_method?(name) }
  attr_writers = attributes.reject { |name| klass.attribute_method?("#{name}=") }
  klass.send(:attr_reader, *attr_readers)
  klass.send(:attr_writer, *attr_writers)
end
validate_each(record, attribute, value)
# File activemodel/lib/active_model/validations/acceptance.rb, line 9
def validate_each(record, attribute, value)
  unless value == options[:accept]
    record.errors.add(attribute, :accepted, options.except(:accept, :allow_nil))
  end
end