This project is archived and is in readonly mode.
Quoting issues in AR's association preload
Reported by Tiago Macedo | July 11th, 2008 @ 04:27 AM | in 2.x
If you look at the source code, there's even a FIXME there:
- FIXME: quoting
def preload_belongs_to_association(records, reflection, preload_options={})
The new eager loading mechanisms incorrectly quotes all primary keys when doing a preload. Obviously this shouldn't be done (at least) for integers and floats.
The information about the "numeric" columns [:integer, :float] was found in
ActiveRecord::ConnectionAdapters::Quoting#quote
This patch doesn't include tests (but didn't break any either) as I couldn't find a decent way to test this.
This is similar to this fix: http://dev.rubyonrails.org/chang... for Rails 1.x
Comments and changes to this ticket
-
Tiago Macedo July 11th, 2008 @ 03:45 PM
Previous patch had a bug if the primary key was a float. This patch fixes it.
-
Pratik July 11th, 2008 @ 10:45 PM
- State changed from new to incomplete
- Assigned user set to Pratik
Hey Tiago,
Could you add a failing test case in AR test suite please ? The test should fail before applying and pass after.
Thanks.
-
Tarmo Tänav July 14th, 2008 @ 08:33 PM
Squashed the commits, added test using features provided by #325 (assert_sql), also added quoting for the primary_key column. Also verified that test fails without the preload code changes.
-
Tiago Macedo July 14th, 2008 @ 09:33 PM
Thanks for the help.
I didn't even notice the primary_key wasn't quoted ;)
-
Repository July 14th, 2008 @ 11:36 PM
- State changed from incomplete to resolved
(from [76df9fa0680d62ce41fa6f3b743c605101d101d2]) Fix integer quoting issues in association preload. [#602 state:resolved]
Signed-off-by: Pratik Naik
-
Repository July 15th, 2008 @ 11:56 PM
(from [84baada079fa7e68750c1e386f9849d2d47b59e1]) Fix integer quoting issues in association preload. [#602 state:resolved]
Signed-off-by: Pratik Naik
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 325 Add assert_query method to AR test_helper Renamed assert_query to assert_sql, test in the patch fo...