diff --git a/Gemfile.lock b/Gemfile.lock index e1e2b18..f6be4db 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - query_helper (0.3.6) + query_helper (0.3.7) activerecord (> 5) activesupport (> 5) sqlite3 diff --git a/lib/query_helper.rb b/lib/query_helper.rb index bd8b1f1..f697ff9 100644 --- a/lib/query_helper.rb +++ b/lib/query_helper.rb @@ -281,7 +281,7 @@ def search_filter(column_maps) placement = :where maps = column_maps.select do |cm| placement = :having if cm.aggregate - @search_fields.include? cm.alias_name + @search_fields.map(&:downcase).include? cm.alias_name.downcase end bind_variable = ('a'..'z').to_a.shuffle[0,20].join.to_sym @bind_variables[bind_variable] = "%#{@search_string}%" diff --git a/lib/query_helper/sql_filter.rb b/lib/query_helper/sql_filter.rb index d512ef6..2b90bb8 100644 --- a/lib/query_helper/sql_filter.rb +++ b/lib/query_helper/sql_filter.rb @@ -17,7 +17,7 @@ def create_filters @filter_values.each do |comparate_alias, criteria| # Find the sql mapping if it exists - map = @column_maps.find { |m| m.alias_name == comparate_alias } + map = @column_maps.find { |m| m.alias_name.downcase == comparate_alias.downcase } raise InvalidQueryError.new("cannot filter by #{comparate_alias}") unless map # create the filter diff --git a/lib/query_helper/version.rb b/lib/query_helper/version.rb index aae9cd6..258d35d 100644 --- a/lib/query_helper/version.rb +++ b/lib/query_helper/version.rb @@ -1,3 +1,3 @@ class QueryHelper - VERSION = "0.3.6" + VERSION = "0.3.7" end