app/models/reserve.rb in enju_circulation-0.4.0.beta.2 vs app/models/reserve.rb in enju_circulation-0.4.0.beta.3
- old
+ new
@@ -1,6 +1,9 @@
class Reserve < ApplicationRecord
- include Statesman::Adapters::ActiveRecordQueries
+ include Statesman::Adapters::ActiveRecordQueries[
+ transition_class: ReserveTransition,
+ initial_state: :pending
+ ]
scope :hold, -> { where('item_id IS NOT NULL') }
scope :not_hold, -> { where(item_id: nil) }
scope :waiting, -> {not_in_state(:completed, :expired, :retained).where('canceled_at IS NULL AND (expired_at > ? OR expired_at IS NULL)', Time.zone.now).order('reserves.id DESC')}
scope :retained, -> {in_state(:retained).where('retained_at IS NOT NULL')}
scope :completed, -> {in_state(:completed).where('checked_out_at IS NOT NULL')}