title: Ruby on Rails search 2 models
body: <p>Right... I've spent 3 days trying to do this myself to no a vale.</p>
  
  <p>I have 2 models called Film and Screenings. Screenings belongs_to Film, Film has_many Screenings.</p>
  
  <p>The Film has certain attributes(:title, :date_of_release, :description, :genre).</p>
  
  <p>The Screening has the attributes(:start_time, :date_being_screened, :film_id(foreign key of Film)).</p>
  
  <p>What I am trying to do is create a Search against both of these models.
  I want to do something like this... </p>
  
  <p>@films = Film.advanced_search(params[:genre], params[:title], params[:start_time], params[:date_showing])</p>
  
  <p>And then in the Film model...</p>
  
  <pre><code>def self.advanced_search(genre, title, start_time, date)
      search_string = "%" + title + "%"
  
      self.find(:all, :conditions =&gt; ["title LIKE ? OR genre = ? OR start_time LIKE ? OR date_showing = ?", title, genre, start_time, date], order: 'title')
      end
  end 
  </code></pre>
  
  <p>I don't think this could ever work quite like this, but I'm hoping my explanation is detailed enough for anyone to understand what im TRYING to do?? :-/</p>
  
  <p>Thanks for any help guys</p>