Files
fizzy/app/models/column.rb
T
2025-11-13 17:30:01 -06:00

11 lines
363 B
Ruby

class Column < ApplicationRecord
include Positioned
belongs_to :board, touch: true
has_many :cards, dependent: :nullify
before_validation -> { self.color ||= Card::DEFAULT_COLOR[:value] }
after_save_commit -> { cards.touch_all }, if: -> { saved_change_to_name? || saved_change_to_color? }
after_destroy_commit -> { board.cards.touch_all }
end