lib/search_party.rb in laserlemon-search_party-0.3.1 vs lib/search_party.rb in laserlemon-search_party-0.3.2
- old
+ new
@@ -15,10 +15,11 @@
def search_parameters
@search_parameters ||= begin
query_parameters.symbolize_keys.inject({}) do |new_parameters, (key, value)|
parsed_value = parse_search_parameter(value)
- if model = self.class.search_parameter_models[key]
+ if model_name = self.class.search_parameter_models[key]
+ model = model_name.to_s.classify.constantize
finder = self.class.search_parameter_finders[key]
new_values = [*parsed_value].map{|v| model.send(finder, v) }
new_value = (parsed_value.is_a?(Array) ? new_values.dup : new_values.first)
else
new_value = parsed_value