Class: Anchor::ModelValidators
- Inherits:
-
Object
- Object
- Anchor::ModelValidators
- Defined in:
- app/helpers/anchor/model_validators.rb
Instance Method Summary collapse
- #attribute_required?(attribute) ⇒ Boolean
-
#initialize(model, options) ⇒ ModelValidators
constructor
A new instance of ModelValidators.
Constructor Details
#initialize(model, options) ⇒ ModelValidators
Returns a new instance of ModelValidators.
3 4 5 6 |
# File 'app/helpers/anchor/model_validators.rb', line 3 def initialize(model, ) @model = model @options = end |
Instance Method Details
#attribute_required?(attribute) ⇒ Boolean
8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/anchor/model_validators.rb', line 8 def attribute_required?(attribute) if .has_key?(:required) [:required] elsif has_validators? attribute_required_by_validators?(attribute) else true # if no validators, assume required end end |