Method: ModelModalHelper#fetch_related_model
- Defined in:
- app/helpers/model_modal_helper.rb
#fetch_related_model(model, relation) ⇒ Object
57 58 59 60 61 62 |
# File 'app/helpers/model_modal_helper.rb', line 57 def (model, relation) # First get the relationship from cache = model.send("#{relation}_id") key = "model_modal::#{relation}::#{related_id}" Rails.cache.fetch(key, expires_in: 6.hours) { model.send(relation) } end |