Bug in eager loading and polymorphic associations?

Hi friends, i’m usgin the edge version because i need eager loading on
polymorphic associations support, but i see this:

Message.find(:first, :include => :owner) #This generate this query:
SQL (0.000072) SET SQL_AUTO_IS_NULL=0
Message Load (0.000389) SELECT * FROM messages
User Load (0.001070) SELECT * FROM users WHERE (users.id IN
(1,2))

And this Message.find(:first, :include => :owner, :limit => 1)
generate this:
Message Load (0.000460) SELECT * FROM messages LIMIT 1
User Load (0.000318) SELECT * FROM users WHERE (users.id IN (2))

Both querys return me the correct owner of message, but in the first
query AR fetch an aditional record, anyboby know why?

Thanks.

Fdavila wrote:

Hi friends, i’m usgin the edge version because i need eager loading on
polymorphic associations support, but i see this:

[snip]

Well in the first case it seems to have ignored your :first. It’s
probably a bug.

Fred

Turns out that this was something that has been lurking for a long
time. it’s fixed now
(http://rails.lighthouseapp.com/projects/8994/changesets/361aaa04ef2f33cb1fe49497c73bc13e6b72addc
)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs