title: Ransack, search multiple columns, one field, rails 3
body: <p>I'm new to Ruby on Rails, and I'm creating my first site. I have a user model with 3 columns: <code>firstname</code>, <code>lastname</code> and <code>email</code>. Im using ransack to make a search engine, and i want to have one search field that will go through every column and display the result.</p>
  
  <p>I have made a <strong>user_controller.rb</strong> looking like this:</p>
  
  <pre><code>@q = User.search(params[:q])
  @users = @q.result(:distinct =&gt; true)
  </code></pre>
  
  <p>And my <strong>User\index.html.erb</strong> looks like this:</p>
  
  <pre><code>&lt;%= search_form_for @search do |f| %&gt;
    &lt;div class="field"&gt;
      &lt;%= f.label :firstname_cont , "Firstname" %&gt;
      &lt;%= f.text_field :firstname_cont %&gt;
      &lt;%= f.label :lastname_cont , "Lastname" %&gt;
      &lt;%= f.text_field :lastname_cont %&gt;
      &lt;%= f.label :email_cont , "Email" %&gt;
      &lt;%= f.text_field :email_cont %&gt;
    &lt;/div&gt;
    &lt;div class="actions"&gt;&lt;%= f.submit "Search" %&gt;&lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>Giving me 3 search fields, but i only want one that goes through firstname, lastname and email.</p>
  
  <p>Edit 1 : 
  After testing some more, I found out that the search field can't handle both firstname AND lastname, or any whitespaces. I have read that it is possible to make a helper_method like this: 
  <a href="https://stackoverflow.com/questions/13309062/searching-multiple-fields-with-ransack/13311237#13311237">Searching multiple fields with Ransack</a></p>
  
  <p>And when I get the search result I get thrown into my model index etc: user / index. Where can I change this?</p>
  
  <p>But there is nothing on how to use it in the view. Why is it so hard to just whrigt, this is what you do :in Controller do this -> in model do this -> in view do this -> And dont forget to fixs the routes like this -> </p>