This project is archived and is in readonly mode.
[PATCH] sanitize_sql_hash_for_conditions uses incorrect table_name
-
ekolve
This occurs for version 2.3.2
-
Will Bryant
Use :conditions => {:authors => {:name => 'BAR'}}. AFAIK :conditions => {'authors.name' => 'BAR'} has never been officially supported, though it may have worked previously.
-
Joel Chippindale
- Tag set to activerecord, patch
The dot notation continues to work and is included in the finder unit tests on master.
The attached fix resolves this problem with the table_names from dot notation keys leaking into subsequent conditions.
-
Joel Chippindale
- Title changed from sanitize_sql_hash_for_conditions uses incorrect table_name to [PATCH] sanitize_sql_hash_for_conditions uses incorrect table_name
-
Joel Chippindale
Judging by responses I have had to this ticket this does not seem to be a well known feature however it has been around for a while and is clearly included in the rails guides
-
Pratik
- State changed from new to incomplete
Hey,
Your patch is missing tests. Could you please add a test ?
Thanks.
-
Pratik
Hey Joel,
Is it possible to write the test without stubbing ? Also the test should be using :joins instead of :include - as per the guide and the recommended way.
Thanks.
-
Joel Chippindale
New patch attached using :joins instead of :include and without the stubbing.
Be aware that (since removing the stubbing) the existing code will pass this test if your installation of ruby happens to process the 'title' hash key before the 'authors.name' key. The patched code will pass the test independently of the order in which the hash keys are processed.
-
Joel Chippindale
This bug is fixed by http://github.com/rails/rails/commit/93f5d9d5f0417c552701996760cc5d...
-
Santiago Pastorino
- State changed from incomplete to open
- Importance changed from to
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
