This project is archived and is in readonly mode.
:joins and :include behave differently with :conditions
-
Josh Kalderimis
- Tag changed from activerecord, associations, include, joins to 2.3.x, activerecord, associations, include, joins
added related version tag
-
Santiago Pastorino
Can you provide a test case?.
Thanks. -
Josh Kalderimis
Hi Santiago,
As I said in the issue, I am not sure how to create a test case for this issue, but I am happy to give it a stab if you can provide me with some pointers or another test which is similar and I can use as an example.
Thanks,
Josh
-
Ryan Bigg
If you're wanting to do conditions on another table you have to use
joinsrather thanincludes, as this will insert an SQL join.includeis more for eager loading of potential records, where as joins will only load records that have that particular join. -
Ryan Bigg
- Assigned user set to Pratik
-
Josh Kalderimis
This issue is very similar to Issue 2908
The core of the issue seems to be that the table alias name is not being applied to the conditions when using
:joins -
Santiago Pastorino
- State changed from new to open
- Tag changed from 2.3.x, activerecord, associations, include, joins to 23x, activerecord, associations, include, joins
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino
- State changed from open to stale
