logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

cacheable.rb (333B)


  1. # frozen_string_literal: true
  2. module Cacheable
  3. extend ActiveSupport::Concern
  4. class_methods do
  5. def cache_associated(*associations)
  6. @cache_associated = associations
  7. end
  8. end
  9. included do
  10. scope :with_includes, -> { includes(@cache_associated) }
  11. scope :cache_ids, -> { select(:id, :updated_at) }
  12. end
  13. end