1
0

cacheable.rb 351 B

123456789101112131415161718192021
  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