You want to use Nested Associations, which are covered here:

http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html

On Dec 1, 12:28 am, chandrakant jain <[email protected]> wrote:
> Hi all
>
> I am using four models  user, member, unit, society
> I have linked member, unit and society through member_property table
> user has one to one association with member while all other models
> have many to many association.
>
> How do I link user to member,  and user to unit through member
>
> i wanted something like
>
>         <%= @user.member.unit.unit_number %></p>
>
> Can someone guide how to achieve this

-- 
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