Module: Stall::Models::ProductList::ClassMethods
- Defined in:
- app/models/stall/models/product_list.rb
Instance Method Summary collapse
-
#aborted(options = {}) ⇒ Object
The .aborted and .finalized scopes cannot be declared as actual rails scopes since subclasses that override the .wizard method wouldn’t be taken into account, scopes being executed in the context of the declaring class.
- #finalized ⇒ Object
- #find_by_reference(reference) ⇒ Object
- #wizard ⇒ Object
Instance Method Details
#aborted(options = {}) ⇒ Object
The .aborted and .finalized scopes cannot be declared as actual rails scopes since subclasses that override the .wizard method wouldn’t be taken into account, scopes being executed in the context of the declaring class
125 126 127 128 |
# File 'app/models/stall/models/product_list.rb', line 125 def aborted( = {}) where.not(state: wizard.steps.last) .older_than(.fetch(:before, 1.day.ago)) end |
#finalized ⇒ Object
130 131 132 |
# File 'app/models/stall/models/product_list.rb', line 130 def finalized where(state: wizard.steps.last) end |
#find_by_reference(reference) ⇒ Object
116 117 118 |
# File 'app/models/stall/models/product_list.rb', line 116 def find_by_reference(reference) where("data->>'reference' = ?", reference).first end |
#wizard ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 |
# File 'app/models/stall/models/product_list.rb', line 134 def wizard wizard_name = Stall.config.default_checkout_wizard if (wizard = Stall::Utils.try_load_constant(wizard_name)) wizard else raise Stall::Checkout::WizardNotFoundError.new, "The checkout wizard #{ wizard_name } was not found. You must generate it " + "with `rails g stall:wizard #{ wizard_name.underscore.gsub('_checkout_wizard', '') }`" end end |