diff --git a/Gemfile.lock b/Gemfile.lock index f972f31..f405ffc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - query_helper (0.4.4) + query_helper (0.4.5) activerecord (> 5) activesupport (> 5) sqlite3 diff --git a/lib/query_helper.rb b/lib/query_helper.rb index a973f2b..fd01ca6 100644 --- a/lib/query_helper.rb +++ b/lib/query_helper.rb @@ -282,7 +282,7 @@ def search_filter(column_maps) raise ArgumentError.new("search_fields not defined") unless @search_fields.length > 0 placement = :where maps = column_maps.select do |cm| - if @search_fields.include? cm.alias_name + if @search_fields.any? { |sf| sf.casecmp?(cm.alias_name) } placement = :having if cm.aggregate true else diff --git a/lib/query_helper/sql_filter.rb b/lib/query_helper/sql_filter.rb index 4838047..9448125 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.casecmp?(comparate_alias) } 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 88a3fde..c7606f3 100644 --- a/lib/query_helper/version.rb +++ b/lib/query_helper/version.rb @@ -1,3 +1,3 @@ class QueryHelper - VERSION = "0.4.4" + VERSION = "0.4.5" end