title: Postgres LIKE in a rails application
body: <p>I have a Postgres <code>LIKE</code> statement like this:</p>
  
  <pre><code>@favorites.find_each do |profiles|
    @related_profiles = Profile.where('name LIKE ?', '%' + profiles.name + '%')
  end
  </code></pre>
  
  <p>What I'm trying to do is loop through the <code>favourites</code> variable and find all profiles that <code>contain</code> some characters of the name. </p>
  
  <p>For example a name <code>"jasson jackson"</code> should be found if the name contains <code>"jackson"</code> or <code>"jasson"</code></p>