validates_with(*args, &block) public

If you pass any additional configuration options, they will be passed to the class and available as options:

class Person
  include ActiveModel::Validations
  validates_with MyValidator, :my_custom_key => "my custom value"
end

class MyValidator < ActiveModel::Validator
  def validate(record)
    options[:my_custom_key] # => "my custom value"
  end
end
Show source
Register or log in to add new notes.