Hi I have the models 1)CompanyRequest has_many :contacts 2)Contact belongs_to :company_request has_and)_belongs_to_many :roles 3)Role has_and)_belongs_to_many :contacts and the join table contact_roles containg role_id,contact_id I have to find out the primary contact(ie contact with role_id = 1 )corresponding to a request Could you please help me to solve this? Thanks in advance Sijo -- Posted via http://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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---