Closed anaice closed 5 years ago
ILIKE
is afaik not in a sql standard, but a postgres extension. mysql and sqlite don't have it - and you need to use collations there or modifiers like UPPER
or LOWER
.
However, if you only seek for being case insensitive:
ILIKE
out of the box.I understand. It is not ANSI SQL, so when using postgres ILIKE is used.
I believe my problem is that my application uses the Postgis adapter (https://github.com/rgeo/activerecord-postgis-adapter)
After seeing your answer I evaluated the file:
search_cop / lib / search_cop / visitors / visitor.rb
I believe this part is not running and postgres specific commands are not used:
#...
extend (SearchCop :: Visitors :: Postgres) if @ connection.adapter_name = ~ / postgres / i
#...
I also did a quick check on the app:
irb(main):004:0> ActiveRecord::Base.connection.instance_of? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
=> false
irb(main):005:0> ActiveRecord::Base.connection.instance_of? ActiveRecord::ConnectionAdapters::PostGISAdapter
=> true
irb(main):006:0> ActiveRecord::Base.connection.adapter_name
=> "PostGIS"
Is there any way to manually set the pg extension in the gem?
Thank's for your time.
PS: Old programmer, but new rubyist here. Sorry for any nonsense.
i see, thx for detailed info. i'll then make the postgis adapter use the postgres extensions. if you feel like it, create a PR. greetings
Hello,
Thanks for this excellent gem!
I have a doubt: is it possible to add an ignore case option for attribute?