lib/trestle/search/resource.rb in trestle-search-0.2.0 vs lib/trestle/search/resource.rb in trestle-search-0.2.1
- old
+ new
@@ -2,20 +2,18 @@
module Search
module Resource
attr_writer :search
def initialize_collection(params)
- query_param = params[:q]
-
- if searchable? && query_param.present?
- search(query_param, params)
+ if searchable?
+ search(params[:q], params)
else
super(params)
end
end
def search(query, params)
- instance_exec(query, params, &@search)
+ instance_exec(query.presence, params, &@search)
end
def searchable?
@search
end