Hi
    Lots of thanks for your great reply.This is what i needed.Now it 
works. But I have one more problem. I have to find group managers name 
and email like above and I tried like below
name_and_email_managers=Group.get_managers_name_and_emails(problem.primary_assignee_group_id)
 
unless problem.primary_assignee_group_id.blank?

And now in Group class
def self.get_managers_name_and_emails(grp_id)
    managers=Group.find_by_id(grp_id).contacts.find(:all,:conditions => 
['group_user_type_id = ?',4])
    managers.each do |manager|
      manager.contact_email_addresses.find(:all, :conditions => 
['contact_email_address_type_id=?',2]).map do |mail|
        [manager.name,mail.email]
      end
    end
end
        But this does not give array like above?Could you please tell me 
where is the fault?A group may have more than one manager and each 
manager has more than one email addresses of the above type.That is why 
I wrote code like above  Groups and Contacts are connected through user 
groups (has_many :through relation)

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