Commit 5906fae0 by liyijie

feat: support order_off

parent a10bc251
...@@ -121,6 +121,7 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -121,6 +121,7 @@ class SimpleController::BaseController < ::InheritedResources::Base
def defaults(options) def defaults(options)
view_path = options.delete(:view_path) view_path = options.delete(:view_path)
@ransack_off = options.delete(:ransack_off) @ransack_off = options.delete(:ransack_off)
@order_off = options.delete(:order_off)
@paginate_off = options.delete(:paginate_off) @paginate_off = options.delete(:paginate_off)
@distinct_off = options.delete(:distinct_off) @distinct_off = options.delete(:distinct_off)
@policy_class = options.delete(:policy_class) || self.name.sub(/Controller$/, 'Policy').safe_constantize @policy_class = options.delete(:policy_class) || self.name.sub(/Controller$/, 'Policy').safe_constantize
...@@ -282,7 +283,7 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -282,7 +283,7 @@ class SimpleController::BaseController < ::InheritedResources::Base
def collection_of_association_chain def collection_of_association_chain
_association_chain = after_of_association_chain _association_chain = after_of_association_chain
if _association_chain.respond_to?(:order) if _association_chain.respond_to?(:order) && !self.class.instance_variable_get(:@order_off)
_association_chain.order(id: :desc) _association_chain.order(id: :desc)
else else
_association_chain _association_chain
......
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