diff --git a/app/models/search.rb b/app/models/search.rb index 0d27cf7b4..fcde85821 100644 --- a/app/models/search.rb +++ b/app/models/search.rb @@ -16,13 +16,14 @@ class Search protected def find_collection(type, term, ability, paginate_params) - if type == 'users' - User.opened - else - type.classify.constantize.accessible_by(ability, :read) - end.search(term). - search_order. - paginate(paginate_params) + scope = if type == 'users' + User.opened + else + type.classify.constantize.accessible_by(ability, :read) + end + scope.search(term). + search_order. + paginate(paginate_params) end end end \ No newline at end of file