Class: Thredded::TopicCommon::CachingHash
- Inherits:
-
Hash
- Object
- Hash
- Thredded::TopicCommon::CachingHash
- Defined in:
- app/models/concerns/thredded/topic_common.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#[](postable) ⇒ Object
lookup related item by postable and set the inverse lookup.
Class Method Details
.from_relation(postable_relation) ⇒ Object
89 90 91 |
# File 'app/models/concerns/thredded/topic_common.rb', line 89 def self.from_relation(postable_relation) self[postable_relation.map { || [.postable_id, ] }] end |
Instance Method Details
#[](postable) ⇒ Object
lookup related item by postable and set the inverse lookup
94 95 96 |
# File 'app/models/concerns/thredded/topic_common.rb', line 94 def [](postable) super(postable.id).tap { || .postable = postable if } end |