Commit fbf6aff1 by ivan Lan

Add ordering desc with created_at to Order's default_scope

parent 85c8abfc
...@@ -33,7 +33,7 @@ module Shotengai ...@@ -33,7 +33,7 @@ module Shotengai
self.table_name = 'shotengai_orders' self.table_name = 'shotengai_orders'
belongs_to :buyer, polymorphic: true, optional: true#, touch: true belongs_to :buyer, polymorphic: true, optional: true#, touch: true
default_scope { where.not(status: 'cart') } default_scope { where.not(status: 'cart').order(created_at: :desc) }
scope :status_is, ->(status) { where(status.blank?.! && { status: status }) } scope :status_is, ->(status) { where(status.blank?.! && { status: status }) }
after_create :set_seq after_create :set_seq
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment