validates_with

validates_with(*args, &block) Instance Public methods Passes the record off to the class or classes specified and allows them to add errors based on more complex conditions. class Person include ActiveModel::Validations validate :instance_validations def instance_validations validates_with MyValidator end end Please consult the class method documentation for more information on creating your own validator. You may also pass it multiple classes, like so: class Per

kind

kind() Class Public methods Returns the kind of the validator. PresenceValidator.kind # => :presence UniquenessValidator.kind # => :uniqueness

new

new(options = {}) Class Public methods Accepts options that will be made available through the options reader.

kind 2

kind() Instance Public methods Returns the kind for this validator. PresenceValidator.new.kind # => :presence UniquenessValidator.new.kind # => :uniqueness

validate

validate(record) Instance Public methods Override this method in subclasses with validation logic, adding errors to the records errors array where necessary.

eager_load!

eager_load!() Class Public methods

gem_version

gem_version() Class Public methods Returns the version of the currently loaded ActiveModel as a Gem::Version

version

version() Class Public methods Returns the version of the currently loaded ActiveModel as a Gem::Version

composed_of

composed_of(part_id, options = {}) Instance Public methods Adds reader and writer methods for manipulating a value object: composed_of :address adds address and address=(new_address) methods. Options are: :class_name - Specifies the class name of the association. Use it only if that name can't be inferred from the part id. So composed_of :address will by default be linked to the Address class, but if the real class name is CompanyAddress, you'll have to specify it with this option

new

new(klass, table, association) Class Public methods