Module: SupportTable::BelongsToSupportTable::ClassMethods
- Defined in:
- lib/support_table/belongs_to_support_table.rb
Instance Method Summary collapse
-
#belongs_to_support_table(name, *args, **kwargs) ⇒ void
Define a
belongs_toassociation that references a support table.
Instance Method Details
#belongs_to_support_table(name, *args, **kwargs) ⇒ void
This method returns an undefined value.
Define a belongs_to association that references a support table. This method takes
the same arguments as belongs_to. It will add a caching layer to the association
to minimize database queries.
18 19 20 21 22 23 24 25 26 |
# File 'lib/support_table/belongs_to_support_table.rb', line 18 def belongs_to_support_table(name, *args, **kwargs) unless include?(SupportTableCache::Associations) include SupportTableCache::Associations end retval = belongs_to name, *args, **kwargs cache_belongs_to name retval end |