Hi.. Actually i need to get User's name Contact's name and it's department id and it's Authority id and authority name. so i done following query. but its so long. I don't know about join queries. so pls help me how can i implemend join query instead of below query....
user = UserInfo.find_by_id(user_id) =>Using this query I get user.first_name contact = UserInfo.find_by_id(contact_id) =>Using this query I get contact.first_name and contact.department_id authority = PrivilegeInfo.find(:first, :conditions => [ "user_id =? and department_id =? ", contact_id,contact.department_id]) =>Using this query I get authority.authority_id authority_name = UserInfo.find_by_id(authority.authority_id) =>Using this query I get authority_name.first_name Thanks in advance -- 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 -~----------~----~----~----~------~----~------~--~---

