Hello
I have two classes
class SolarSystem < ActiveRecord::Base
has_many :fow_ss_entries, :dependent => :delete_all
class FowSsEntry < ActiveRecord::Base
belongs_to :galaxy
belongs_to :solar_system
belongs_to :player
named_scope :for, Proc.new { |galaxy, player|
galaxy = galaxy.id if galaxy.is_a? Galaxy
player = player.id if player.is_a? Player
{
:conditions => {:galaxy_id => galaxy, :player_id => player},
:include => :solar_system
}
}
Now the evil thing is, that even thou' :include is specified, it does
nothing. New AR eager loading resorts to doing n+1 sql queries in
FowSsEntry.for(1,1).each { |fse| fse.solar_system }
How do I force it into joining my table, without impacting my SQL
performance?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---