Commit c8022a77 by ivan Lan

Add order by created_at to the default_scope of product

parent 350e5649
...@@ -36,6 +36,7 @@ module Shotengai ...@@ -36,6 +36,7 @@ module Shotengai
belongs_to :manager, polymorphic: true, optional: true#, touch: true belongs_to :manager, polymorphic: true, optional: true#, touch: true
validate :check_spec, if: :spec validate :check_spec, if: :spec
default_scope { order(created_at: :desc) }
scope :alive, -> { where.not(status: 'deleted') } scope :alive, -> { where.not(status: 'deleted') }
scope :recycle_bin, ->{ unscope(where: :status).deleted.where('updated_at > ?', Time.now - 10.day )} scope :recycle_bin, ->{ unscope(where: :status).deleted.where('updated_at > ?', Time.now - 10.day )}
......
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