Marnen!

Thank you so much.  I'll take a look at the nested_has_many_through
plugin.  I needed your guidance: googling for something like that
without using the technical term "nested" was fruitless.

Vincent.
On Feb 3, 7:52 pm, Marnen Laibow-Koser <[email protected]> wrote:
> Learn by Doing wrote:
> > Hi,
>
> > I have the following 3 models.  User , Relationship_type, and Link.
>
> >      User
> > has_many :relationship_types
>
> >      Relationship_type
>
> Should be RelationshipType.
>
> > belongs_to :users
> Should be :user.
> > has_many :links
>
> >       Link
> > belongs_to :relationship_type
>
> > The Link model has a column :partner.  I'd like to find all partners
> > of a user so I'd like to say in User model
>
> > has_many :partners
> >                 :through  => :relationship_type, :link
>
> > but that creates errors.  How can I do this to be able to say
> > something like userA.partners  
>
> You may want to look at the nested_has_many_through plugin.
>
>
>
> > Similarly, how can I do the reverse, getting all users that link to a
> > partner , e.g. partnerA.users?
>
> > In addition, how can I get to User from Link, to say something like
> > linkA.user  ?
>
> link.relationship_type.user
> or you can use :through.
>
> Best,
> -- 
> Marnen Laibow-Koserhttp://www.marnen.org
> [email protected]
>
>
>
> > Thanks.
>
> --
> Posted viahttp://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.

Reply via email to