class method
self.new
Ruby on Rails 3.1.12
Since v3.0.20Signature
self.new(options)
Returns a new validator instance. All options will be available via the options reader, however the :attributes option will be removed and instead be made available through the attributes reader.
Parameters
-
optionsreq
Source
# File activemodel/lib/active_model/validator.rb, line 139
def initialize(options)
@attributes = Array.wrap(options.delete(:attributes))
raise ":attributes cannot be blank" if @attributes.empty?
super
check_validity!
end
Defined in activemodel/lib/active_model/validator.rb line 139
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::EachValidator