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")
}
如何在创建ShiftEntryshift_notes_count
时不增加shift_note.state.canceled? => true
现在我shift_entries_count
是只读的。