Module: LowCardTables::HasLowCardTable::Base
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/low_card_tables/has_low_card_table/base.rb
Overview
This module gets included (once) into any class that has declared a reference to at least one low-card table, using #has_low_card_table. It is just a holder for several related objects that do all the actual work of implementing the referring side of the low-card system.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#_low_card_objects_manager ⇒ Object
Returns the LowCardObjectsManager, which is responsible for maintaining the set of low-card objects accessed by this model object – the instances of the low-card class that are “owned” by this object.
-
#low_card_update_foreign_keys! ⇒ Object
Updates the current values of all low-card reference columns according to the current attributes.
Instance Method Details
#_low_card_objects_manager ⇒ Object
Returns the LowCardObjectsManager, which is responsible for maintaining the set of low-card objects accessed by this model object – the instances of the low-card class that are “owned” by this object. See that class’s documentation for more information.
109 110 111 |
# File 'lib/low_card_tables/has_low_card_table/base.rb', line 109 def _low_card_objects_manager @_low_card_objects_manager ||= LowCardTables::HasLowCardTable::LowCardObjectsManager.new(self) end |
#low_card_update_foreign_keys! ⇒ Object
Updates the current values of all low-card reference columns according to the current attributes. This is automatically called in a #before_save hook; you can also call it yourself at any time. Note that this can cause new low-card rows to be created, if the current combination of attributes for a given low-card table has not been used before.
102 103 104 |
# File 'lib/low_card_tables/has_low_card_table/base.rb', line 102 def low_card_update_foreign_keys! self.class._low_card_associations_manager.low_card_update_foreign_keys!(self) end |