On Nov 18, 1:19 am, sigvei <[EMAIL PROTECTED]> wrote:
> On 17 Nov, 14:38, Daniel Bush <[EMAIL PROTECTED]> wrote:
>
> > 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)... ?
>
> ActiveRecord::Base::first is a convenience wrapper for
> ActiveRecord::Base::find(:first), according to the API. So I can't
> quite see why that should make a difference.
Sorry. Wasn't familiar with it. Hard to imagine rails putting in a
random id.
Can only surmise that
Document.first.proposals.first.id==2
I don't think any order is guaranteed either unless you've
specified :order somewhere so it may change randomly depending on your
database. Maybe you added a new proposal with no proposal versions in
addition to proposal with id=1. Or a new document even.
--
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
-~----------~----~----~----~------~----~------~--~---