title: Build static dropdown menu for simple search Rails 3
body: <p>I have a simple search working in my rails app, but it only searches a single column of my table. I'm trying to add a simple dropdown menu with options like "last_name" and "city" so the user can select the column to search.</p>
  
  <p>In my view I have:</p>
  
  <pre><code>&lt;%= form_tag teachers_path, :method =&gt; 'get', :id =&gt; "teachers_search" do %&gt;
  &lt;%= hidden_field_tag :direction, params[:direction]%&gt;
  &lt;%= hidden_field_tag :sort, params[:sort]%&gt;
    &lt;p&gt;
      &lt;%= text_field_tag :search, params[:search], placeholder: 'First Name' %&gt;
      &lt;%= submit_tag "Search", :first_name =&gt; nil %&gt;
    &lt;/p&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>and in my model:</p>
  
  <pre><code> def self.search(search)
      if search
        where('first_name LIKE ?', "%#{search}%")
      else
        scoped
      end
    end
  </code></pre>
  
  <p>Any help greatly appreciated.</p>