title: ruby on rails implement a search form that searches multiple relations
body: <p>I've implemented a simple search form (according to the "simple form" screencast) that searches the "illnesses" table in my DB.
  Now I want the same search box to search both the "illnesses" table and the "symptoms" table.</p>
  
  <p>My code currently looks like this:</p>
  
  <p>main_page\index.html.erb:</p>
  
  <pre><code>&lt;b&gt;Illnesses&lt;/b&gt;
      &lt;%= form_tag illnesses_path, :method =&gt; 'get' do %&gt;
        &lt;p&gt;
          &lt;%= text_field_tag :search, params[:search] %&gt;&lt;br/&gt;
          &lt;%= submit_tag "Illnesses", :name =&gt; nil %&gt;&lt;br/&gt;
        &lt;/p&gt;
  </code></pre>
  
  <p>illnesses_controller.rb:</p>
  
  <pre><code>class IllnessesController &lt; ApplicationController
      def index
      @illnesses = Illness.search(params[:search])
  
      respond_to do |format|
          format.html # index.html.erb
          format.json { render json: @illnesses }
      end
      ...
  end
  </code></pre>
  
  <p>illness.rb:</p>
  
  <pre><code>class Illness &lt; ActiveRecord::Base
      ...
  
      def self.search(search)
      if search
          find(:all, :conditions =&gt; ['name LIKE ?', "%#{search}%"])
      else
          find(:all)
      end
   end
  </code></pre>
  
  <p>Could you please guide me how to implement this extension?
  I'm a beginner (obviously) and I don't really know what should be the "form_tag" action, where should I implement it and which class should implement the extended search...</p>
  
  <p>Thanks,
  Li</p>