Class: ForeignKeyValidation::Filter
- Inherits:
-
Object
- Object
- ForeignKeyValidation::Filter
- Defined in:
- lib/foreign_key_validation/filter.rb
Instance Attribute Summary collapse
-
#collector ⇒ Object
Returns the value of attribute collector.
Instance Method Summary collapse
- #before_filter(&block) ⇒ Object
-
#initialize(collector) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(collector) ⇒ Filter
Returns a new instance of Filter.
6 7 8 |
# File 'lib/foreign_key_validation/filter.rb', line 6 def initialize(collector) self.collector = collector end |
Instance Attribute Details
#collector ⇒ Object
Returns the value of attribute collector.
4 5 6 |
# File 'lib/foreign_key_validation/filter.rb', line 4 def collector @collector end |
Instance Method Details
#before_filter(&block) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/foreign_key_validation/filter.rb', line 10 def before_filter(&block) collector.klass.send :define_method, filter_name do self.instance_eval &block return true end collector.klass.send :private, filter_name.to_sym collector.klass.public_send :before_validation, filter_name end |