Merge pull request #1787 from basecamp/gild-cache

Fix: cascade touches not touching boards
This commit is contained in:
Jorge Manrubia
2025-12-02 05:58:35 +01:00
committed by GitHub
2 changed files with 16 additions and 0 deletions
+1
View File
@@ -16,6 +16,7 @@ class Card < ApplicationRecord
before_create :assign_number
after_save -> { board.touch }, if: :published?
after_touch -> { board.touch }, if: :published?
after_update :handle_board_change, if: :saved_change_to_board_id?
scope :reverse_chronologically, -> { order created_at: :desc, id: :desc }
+15
View File
@@ -24,4 +24,19 @@ class Card::GoldenTest < ActiveSupport::TestCase
assert_includes Card.golden, cards(:logo)
assert_not_includes Card.golden, cards(:text)
end
test "gilding a card touches both the card and the board" do
card = cards(:text)
board = card.board
card_updated_at = card.updated_at
board_updated_at = board.updated_at
travel 1.minute do
card.gild
end
assert card.reload.updated_at > card_updated_at
assert board.reload.updated_at > board_updated_at
end
end