Marnen Laibow-Koser wrote: > Marnen Laibow-Koser wrote: >> Hemant Bhargava wrote: >>> Hi Sharagoz, >>> >>> This query is not working.. My model names are Leaves and Employee and >>> table names are leaves and employees. So i tried this query as:- >>> Leaves.find_by_employee_id (:employee_id, :joins => :employee, >>> :conditions => [ "employees.manager_id = ?", >>> session[:employee].manager_id ] ) >>> >>> But no results :'( >> >> You shouldn't be using both find_by_* and :conditions. Pick one or the >> other. > > Also note that the first argument in your code is different from what > you were given. > > Hemant, I've said this to you before and I'll say it again: go read some > basic Rails tutorials. You're posting a lot of beginner questions to > the list, and that's a waste of your time and ours. Please spend less > time posting and more time reading.
Ohh .. Ok Sorry but i have already tried it using myself.. Used googling.. Read joins .. But i came up with nothing thats why i posted my ques here.. Anewayz, I'll take care of it in future as well.. > >> >>> >>> Sharagoz -- wrote: >>>> Something like >>>> Leave.find_by_employee_id(employee_id, :joins => :employee, :conditions >>>> => ["employees.manager_id=?", manager_id]) >> >> Best, >> -- >> Marnen Laibow-Koser >> http://www.marnen.org >> mar...@marnen.org -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.