Hemant Bhargava 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. > > Ok fine.. Then i tried with using two queries:- > 1) Leaves.find(:employee_id, :joins => :employee, :conditions => [ > "employees.manager_id = ?", session[:employee].manager_id ] ) > > 2) Leaves.find_by_employee_id (:employee_id, :joins => :employee) > > Both of them are not working.. >
Because your first argument in each case is *still* wrong. Look carefully at the example that was given to you. If you can't see the difference here, then you have no business programming in Ruby without further study. > >> > >> -- >> 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.