title: advance table search in rails
body: <p>In my app i have generated a scaffold called data and had filed the table with name, school, college, views, interest.
  Now i want to add a search that if someone put NAME in the search bar, they should get all the names only as results, if someone had put college, they should get all the college only.</p>
  
  <p>Am pretty new to rails, so i tried watching some tutorials, and had added this but this is not what i want </p>
  
  <pre><code>&lt;%= form_tag data_path, :method =&gt; 'get' do %&gt;
  &lt;%= text_field_tag :search, params[:search] %&gt;
  &lt;%= submit_tag "Search" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p><strong>in controller</strong></p>
  
  <pre><code>  def index
      @data = Datum.where (["name LIKE ?", "%#{params[:search]}%"])
    end
  </code></pre>
  
  <p>This had added a search but not the type of search i had mentioned above.</p>