Can i use a model object directly in a find

Posted by user340100 on Stack Overflow See other posts from Stack Overflow or by user340100
Published on 2010-05-13T09:12:03Z Indexed on 2010/05/13 9:14 UTC
Read the original article Hit count: 155

Filed under:
|
|
|

Hi, Can i pass a_teacher directly into the find? or do i have to compare each of its attributes as i have done here? thanks

a_teacher = Techer.new(:name => "Bob", :age => 30)

self.classes.all(:conditions => ["teacher.name = ? AND teacher.age = ?", a_teacher.name,a_teacher.age], :joins => :teacher)

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about find