Module: DependentProtect::ClassMethods
- Defined in:
- lib/dependent_protect.rb
Instance Method Summary collapse
- #has_and_belongs_to_many_with_protect(association_id, options = {}, &extension) ⇒ Object
-
#has_many_with_protect(association_id, options = {}, &extension) ⇒ Object
:nodoc:.
-
#has_one_with_protect(association_id, options = {}, &extension) ⇒ Object
We should be aliasing configure_dependency_for_has_many but that method is private so we can’t.
Instance Method Details
#has_and_belongs_to_many_with_protect(association_id, options = {}, &extension) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/dependent_protect.rb', line 38 def has_and_belongs_to_many_with_protect(association_id, = {}, &extension) reflection = create_reflection(:has_and_belongs_to_many, association_id, , self) add_dependency_callback!(reflection, ) .delete(:dependent) has_and_belongs_to_many_without_protect(association_id, , &extension) end |
#has_many_with_protect(association_id, options = {}, &extension) ⇒ Object
:nodoc:
32 33 34 35 36 |
# File 'lib/dependent_protect.rb', line 32 def has_many_with_protect(association_id, = {}, &extension) #:nodoc: reflection = create_reflection(:has_many, association_id, , self) add_dependency_callback!(reflection, ) has_many_without_protect(association_id, , &extension) end |
#has_one_with_protect(association_id, options = {}, &extension) ⇒ Object
We should be aliasing configure_dependency_for_has_many but that method is private so we can’t. We alias has_many instead trying to be as fair as we can to the original behaviour.
26 27 28 29 30 |
# File 'lib/dependent_protect.rb', line 26 def has_one_with_protect(association_id, = {}, &extension) #:nodoc: reflection = create_reflection(:has_one, association_id, , self) add_dependency_callback!(reflection, ) has_one_without_protect(association_id, , &extension) end |