Fix #5225: PG::AmbiguousColumn: ERROR: column reference "bit_prefs" is ambiguous
This commit is contained in:
@@ -41,7 +41,7 @@ module HasBitFlags
|
||||
bits = attributes.length
|
||||
bit_index = bits - attributes.index(flag.to_s) - 1
|
||||
|
||||
where(sanitize_sql(["get_bit(#{field}::bit(?), ?) = ?", bits, bit_index, value]))
|
||||
where(sanitize_sql(["get_bit(#{table_name}.#{field}::bit(?), ?) = ?", bits, bit_index, value]))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user