instance method
validators
Ruby on Rails 7.2.3
Since v3.0.20Signature
validators()
List all validators that are being used to validate the model using validates_with method.
class Person include ActiveModel::Validations validates_with MyValidator validates_with OtherValidator, on: :create validates_with StrictValidator, strict: true end Person.validators # => [ # #<MyValidator:0x007fbff403e808 @options={}>, # #<OtherValidator:0x007fbff403d930 @options={on: :create}>, # #<StrictValidator:0x007fbff3204a30 @options={strict:true}> # ]
Source
# File activemodel/lib/active_model/validations.rb, line 208
def validators
_validators.values.flatten.uniq
end
Defined in activemodel/lib/active_model/validations.rb line 208
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Validations::ClassMethods