Module: ForeignKeyValidation::ModelExtension::ClassMethods
- Defined in:
- lib/foreign_key_validation/model_extension.rb
Instance Method Summary collapse
Instance Method Details
#validate_foreign_keys(opt = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/foreign_key_validation/model_extension.rb', line 7 def validate_foreign_keys(opt={}) descendants.map {|klass| klass.public_send(:validate_foreign_keys, opt)} if ForeignKeyValidation.configuration.inject_subclasses collector = Collector.new(opt.merge(klass: self)) collector.check! Filter.new(collector).before_filter do Validator.new(validate_against_key: collector.validate_against_key, reflection_names: collector.validate_with, object: self).validate end end |