[#330] small refactoring
This commit is contained in:
parent
89f322cd24
commit
2bca1f441c
|
@ -16,13 +16,14 @@ class Search
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def find_collection(type, term, ability, paginate_params)
|
def find_collection(type, term, ability, paginate_params)
|
||||||
if type == 'users'
|
scope = if type == 'users'
|
||||||
User.opened
|
User.opened
|
||||||
else
|
else
|
||||||
type.classify.constantize.accessible_by(ability, :read)
|
type.classify.constantize.accessible_by(ability, :read)
|
||||||
end.search(term).
|
end
|
||||||
search_order.
|
scope.search(term).
|
||||||
paginate(paginate_params)
|
search_order.
|
||||||
|
paginate(paginate_params)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue