Skip to content

Commit

Permalink
Cast appropriate type when generating where query. (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
guoy-freeletics authored Aug 20, 2024
1 parent b8162e9 commit b171518
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/array_enum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def array_enum(definitions)
db_values = Array(values).map do |value|
mapping_hash[value] || raise(ArgumentError, format(MISSING_VALUE_MESSAGE, value: value, attr: attr_name))
end
where("#{table_name}.#{attr_name} #{comparison_operator} ARRAY[:db_values]", db_values: db_values)
where("#{table_name}.#{attr_name} #{comparison_operator} ARRAY[:db_values]::integer[]", db_values: db_values)
end
end

Expand Down

0 comments on commit b171518

Please sign in to comment.