ShiftNote
belongs_to :shift, counter_cache: true
workflow do
state :scheduled
state :canceled
end
Shift
has_many :shift_notes
scope :opened, lambda {
locked
.where("shift_notes_count < shifts.limit")
}
ShiftEntry作成shift_notes_count
時に増やさない方法shift_note.state.canceled? => true
現在、私のshift_entries_count
は読み取り専用です。