Skip to content

Commit

Permalink
Single value
Browse files Browse the repository at this point in the history
  • Loading branch information
Willianvdv committed May 7, 2014
1 parent a48a925 commit 4ea06a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/h_store_filter/filter_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ def filter
@filterables.each do |filterable|
filters_per_filterable = []
property = filterable.property
@params[property.name].each do |value|

values = @params[property.name]
values = [values] unless values.is_a? Array

values.each do |value|
hstore_filter = ActiveRecord::Base.sanitize "\"#{property.name}\"=>\"#{value}\""
filters_per_filterable << "data @> #{hstore_filter}::hstore"
end
Expand Down

0 comments on commit 4ea06a3

Please sign in to comment.