闭社主体 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.

21 lines
351 B

  1. # frozen_string_literal: true
  2. module Cacheable
  3. extend ActiveSupport::Concern
  4. module ClassMethods
  5. @cache_associated = []
  6. def cache_associated(*associations)
  7. @cache_associated = associations
  8. end
  9. def with_includes
  10. includes(@cache_associated)
  11. end
  12. def cache_ids
  13. select(:id, :updated_at)
  14. end
  15. end
  16. end