Fix #5225: PG::AmbiguousColumn: ERROR: column reference "bit_prefs" is ambiguous

This commit is contained in:
evazion
2022-07-02 17:37:22 -05:00
parent 0d953e2492
commit 6386962357

View File

@@ -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