Files
fizzy/app/models/card/cacheable.rb
T
Jason Zimdars fcba8b6acb Add column color to cache keys
So cards change colors when you change the column color
2025-10-08 17:08:32 -05:00

28 lines
564 B
Ruby

module Card::Cacheable
extend ActiveSupport::Concern
def cache_key
[ super, collection.name ].compact.join("/")
end
def cache_invalidation_parts
@cache_invalidation_parts ||= InvalidationParts.new(self)
end
class InvalidationParts
attr_reader :card
def initialize(card)
@card = card
end
def for_perma(*other)
[ card, User.all, Tag.all, *other ]
end
def for_preview(*other)
[ card, card.collection.entropy_configuration, card.collection.publication, card.column&.color, *other ]
end
end
end