Commit 9042ae94 by liyijie

refector collection

parent 31b888b0
...@@ -9,3 +9,4 @@ ...@@ -9,3 +9,4 @@
# rspec failure tracking # rspec failure tracking
.rspec_status .rspec_status
.DS_Store
...@@ -49,13 +49,17 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -49,13 +49,17 @@ class SimpleController::BaseController < ::InheritedResources::Base
association association
end end
def collection def ransack_paginate(association)
get_collection_ivar || set_collection_ivar( association.ransack(
after_association_chain(end_of_association_chain).ransack( params[:q]
params[:q] ).result.distinct.paginate(
).result.distinct.paginate( page: params[:page], per_page: params[:per_page]
page: params[:page], per_page: params[:per_page]
)
) )
end end
def collection
association = super
association = after_association_chain(association)
ransack_paginate(association)
end
end end
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