This project is archived and is in readonly mode.
Still a bug in association_preload.rb ?
Reported by rogergl | September 4th, 2009 @ 12:54 PM
if I specify my own primary key for belongs_to:
class Price < ActiveRecord::Base
belongs_to article :primary_key => "produktnr"
end
and use a nested include:
class AllPrices
named_scope :all_record :include => [:price => :article]
end
Preloading for article doesn't work sind the ids are taken for the select and not the given primary key.
I think there is a bug on line 324 of association_preload. I think it should honour the primary key given in the belongs_to statement.
Regards
Roger
Comments and changes to this ticket
-
rogergl September 4th, 2009 @ 08:16 PM
Changing line 324
seems to make preloading work as expected:
primary_key = options[:primary_key] || klass.primary_key
At least I get as many (106 failures with JRuby) unit tests failures for the ActiveRecord test suite as before.
Regards
Roger -
Ryan Bigg May 25th, 2010 @ 11:15 AM
- State changed from new to open
Line 324 in where? Please provide more information.
-
rogergl May 26th, 2010 @ 06:39 AM
The error was in association_preload.rb but seems to be fixed in Rails 3.
Regards
Roger -
José Valim May 26th, 2010 @ 07:46 AM
- State changed from open to resolved
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>