Commit 9042ae94 by liyijie

refector collection

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