-
Notifications
You must be signed in to change notification settings - Fork 200
Closed
Description
This is quite a nasty issue because of its rather broad impact. It disrupts the operation of other gems that rely on Arel, most notably the Ransack gem where any "contains"-type search on an enumerized field gives the wrong results.
Enumerize version: 2.1.2
Reproduce:
class User < ApplicationRecord
extend Enumerize
enumerize :role, in: [:user, :a_admin, :b_admin], predicates: true
endt = User.arel_table
puts User.where(t[:role].matches '%admin%').to_sql
Outcome:
SELECT "users".* FROM "users" WHERE ("users"."role" LIKE NULL) -- LIKE NULL ?!?Expected outcome (this is produced w/o the enumerize line):
SELECT "users".* FROM "users" WHERE ("users"."role" LIKE "%admin%")Metadata
Metadata
Assignees
Labels
No labels