Association problem

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

Can someone guide how to achieve this

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

thank you so much
I will check on this

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