title: Returning search results inside of a Rails 3 app
body: <p>We followed Ryan Bates' Railscast #37, and the search form appears without error on our app, but is not functional. It doesnt return any search results.</p>
  
  <p>UsersController:</p>
  
  <pre><code>class UsersController &lt; ApplicationController
  
  def index
    @title = "All users"
  
    @users = User.search(params[:search])
  end
  </code></pre>
  
  <p>The search function is defined in our user.rb file</p>
  
  <pre><code>def self.search(search)
    if search
    where('name LIKE ?', "%#{search}%")
    else
    all
   end
  end
  </code></pre>
  
  <p>and finally our index.html.erb file where that search box is displayed</p>
  
  <pre><code>&lt;h1&gt;All users&lt;/h1&gt;
  
  &lt;%= form_tag users_path, :method =&gt; 'get' do %&gt;
  &lt;p&gt;
  &lt;%= text_field_tag :search, params[:search] %&gt;
  &lt;%= submit_tag "Search", :name =&gt; nil %&gt;
  &lt;/p&gt;
  &lt;% end %&gt;
  </code></pre>