app/models/shoppe/order/states.rb in shoppe-0.0.19 vs app/models/shoppe/order/states.rb in shoppe-0.0.20
- old
+ new
@@ -16,19 +16,19 @@
# Validations
validates :status, :inclusion => {:in => STATUSES}
# Set the status to building if we don't have a status
- before_validation { self.status = 'building' if self.status.blank? }
+ after_initialize { self.status = STATUSES.first if self.status.blank? }
# All orders which have been received
scope :received, -> {where("received_at is not null")}
# All orders which are currently pending acceptance/rejection
scope :pending, -> { where(:status => 'received') }
# All ordered ordered by their ID desending
- scope :ordered, -> { order('id desc')}
+ scope :ordered, -> { order(:id => :desc)}
# Is this order still being built by the user?
#
# @return [Boolean]
def building?