Class: ForeignKeyValidation::Validator
- Inherits:
-
Object
- Object
- ForeignKeyValidation::Validator
- Defined in:
- lib/foreign_key_validation/validator.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
-
#reflection_names ⇒ Object
Returns the value of attribute reflection_names.
-
#validate_against_key ⇒ Object
Returns the value of attribute validate_against_key.
Instance Method Summary collapse
-
#initialize(opt = {}) ⇒ Validator
constructor
A new instance of Validator.
- #validate ⇒ Object
Constructor Details
#initialize(opt = {}) ⇒ Validator
Returns a new instance of Validator.
7 8 9 10 11 |
# File 'lib/foreign_key_validation/validator.rb', line 7 def initialize(opt={}) self.validate_against_key = opt[:validate_against_key] self.reflection_names = opt[:reflection_names] || [] self.object = opt[:object] end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
5 6 7 |
# File 'lib/foreign_key_validation/validator.rb', line 5 def object @object end |
#reflection_names ⇒ Object
Returns the value of attribute reflection_names.
5 6 7 |
# File 'lib/foreign_key_validation/validator.rb', line 5 def reflection_names @reflection_names end |
#validate_against_key ⇒ Object
Returns the value of attribute validate_against_key.
5 6 7 |
# File 'lib/foreign_key_validation/validator.rb', line 5 def validate_against_key @validate_against_key end |
Instance Method Details
#validate ⇒ Object
13 14 15 |
# File 'lib/foreign_key_validation/validator.rb', line 13 def validate to_enum(:invalid_reflection_names).map {|n| attach_error(n) }.any? end |