You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the ransackable_attributes method in ActiveRecord, passing an array of symbols causes the search conditions for the corresponding attributes to be ignored. However, passing an array of strings works as expected.
Steps to Reproduce
1: Create a migration for a users table with a name column:
When using the ransackable_attributes method in ActiveRecord, passing an array of symbols causes the search conditions for the corresponding attributes to be ignored. However, passing an array of strings works as expected.
Steps to Reproduce
1: Create a migration for a users table with a name column:
2: Define the User model with ransackable_attributes returning a symbol array:
3: Attempt to perform a Ransack query with a condition on the name attribute:
User.ransack(name_cont: "hoge").result.to_sql
Actual Behavior
The generated SQL query ignores the condition for name:
SELECT "users".* FROM "users"
I expected
SELECT "users".* FROM "users" WHERE "users"."name" LIKE '%hoge%'
===
The code below returned the expected results:
===
Ruby version: 3.3.6
Rails version: 7.2.2
ransack version: 4.2.1
The text was updated successfully, but these errors were encountered: