闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
333 B

  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