No need for validation when we have rely on update!/create! on db constraints

This commit is contained in:
David Heinemeier Hansson
2025-11-02 14:19:26 +01:00
parent 0af74bfa11
commit d6c88736bd
-3
View File
@@ -4,9 +4,6 @@ class Column < ApplicationRecord
belongs_to :collection, touch: true
has_many :cards, dependent: :nullify
validates :name, presence: true
validates :color, presence: true
before_validation :set_default_color
after_save_commit -> { cards.touch_all }, if: -> { saved_change_to_name? || saved_change_to_color? }
after_destroy_commit -> { collection.cards.touch_all }