class ActiveModel::Validations::AcceptanceValidator

def initialize(options)

def initialize(options)
  super(options.reverse_merge(:allow_nil => true, :accept => "1"))
end

def setup(klass)

def setup(klass)
  # Note: instance_methods.map(&:to_s) is important for 1.9 compatibility
  # as instance_methods returns symbols unlike 1.8 which returns strings.
  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

def validate_each(record, attribute, value)

def validate_each(record, attribute, value)
  unless value == options[:accept]
    record.errors.add(attribute, :accepted, options.except(:accept, :allow_nil))
  end
end