title: Search multiple columns - Rails
body: <p>I am currently writing a search method for my rails applications, and at the moment it works fine. I have the following in my game.rb:</p>
  
  <pre><code>def self.search(search)
    if search
      find(:all, :conditions =&gt; ['game_name LIKE ? OR genre LIKE ? OR console LIKE ?', "%#{search}%", "#{search}", "#{search}"])
    else
      find(:all)
    end
  end
  </code></pre>
  
  <p>Now that searches fine, but my problem is that if there is a record in game_name that has the word 'playstation' in it, it will finish the search there. It only returns that record, rather than all games that have 'playstation' stored in console. Now I understand this is because I have 'OR' in my conditions, but I don't know an alternative. 'AND' requires all the conditions to match or none return at all. What is an alternative I can use to AND and OR? Help would be much appreciated. </p>
  
  <p>If there is a solution that has separate search boxes and entries, then that would be fine, I don't necessarily require the search to find it all based on one search form.</p>