On Nov 17, 11:56 pm, sigvei <[EMAIL PROTECTED]> wrote:
> I have the following relationships:
>
> Document :has_many Proposals :has_many ProposalVersions.
>
> This fails:>> Document.first.proposals.first.proposal_versions.size

Do you mean Document.find(:first)...  ?

>
> => 0
>
> But this works:>> Proposal.find(1).proposal_versions.size
>
> => 2
>
> Here's the SQL from the first statement:
>
> SELECT count(*) AS count_all FROM "proposal_versions" WHERE
> ("proposal_versions".proposal_id = 2)
>
> The failing SQL in the first example seems really dangerous, because
> it apparently picks an ID at random (and this obviously works also
> with non-count queries, resulting in possibly returning the wrong set
> of data:
>
> Where does the '2' come from? Neither Document or Proposal has ID 2,
> they're both ID 1.
>
> Is this expected behaviour?
>
> I'm on rails 2.2.1 (eh, 2.2 RC2). Linux. SQlite.

-- Daniel Bush
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to