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
If the search query is "Users who have gone on trips 'ABC' and 'DEF'", how does one do it? I tried two different approaches:
Two separate conditions with name = 'ABC' and name = 'DEF'. This was done with "matches all". The SQL gave 0 results (obviously) as this was generated:
The 2nd query results were those users who had either gone on ABC or DEF.
To add to this, we wanted this query: "Users who have gone on ABC but not on DEF". I tried this with two conditions (matches all): trip.name = ABC and trips.name not like DEF. This was the SQL generated:
SELECT DISTINCT users.*FROM users LEFT OUTER JOIN registrations ONregistrations.user_id=users.idLEFT OUTER JOIN trips ONtrips.id=registrations.batch_idWHERE ((trips.nameLIKE'%ABC%'ANDtrips.name NOT LIKE'%DEF%'))
The above query isn't right. How does one get the right query using Ransack?
The text was updated successfully, but these errors were encountered:
My User model has the following association: user has_many trips, through registrations.
If the search query is "Users who have gone on trip named 'ABC'", the SQL generated is fine:
If the search query is "Users who have gone on trips 'ABC' and 'DEF'", how does one do it? I tried two different approaches:
The 2nd query results were those users who had either gone on ABC or DEF.
To add to this, we wanted this query: "Users who have gone on ABC but not on DEF". I tried this with two conditions (matches all): trip.name = ABC and trips.name not like DEF. This was the SQL generated:
The above query isn't right. How does one get the right query using Ransack?
The text was updated successfully, but these errors were encountered: