Module: TinyCache::ActiveRecord::Associations::HasManyAssociation
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/tiny_cache/active_record/has_many_association.rb
Instance Method Summary collapse
Instance Method Details
#association_class ⇒ Object
16 17 18 |
# File 'lib/tiny_cache/active_record/has_many_association.rb', line 16 def association_class @reflection.klass end |
#find_target_with_tiny_cache ⇒ Object
在缓存中取的数据
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tiny_cache/active_record/has_many_association.rb', line 21 def find_target_with_tiny_cache return find_target_without_tiny_cache unless association_class.tiny_cache_enabled? records = if [:finder_sql] reflection.klass.find_by_sql(custom_finder_sql) else scoped.all end records = [:uniq] ? uniq(records) : records records.each { |record| set_inverse_instance(record) } records end |