title: How to include a LIKE clause in Rails query on HABTM join table
body: <p>I have 2 models - Candidate and Keyword and has_and_belongs_to_many association between them. </p>
  
  <p>If i want to find all candidates where a keyword.name equals to sth - i just need to do a search in Candidate model like this-and it works fine.</p>
  
  <pre><code>def self.search(search)
          includes(:keywords).where("keywords.name" =&gt; "#{search}")
  end
  </code></pre>
  
  <p>But what if i need to search for candidates where keyword.name contains a string (equivalent of "LIKE" clause)? I've tried multiple ideas but cannot find a good solution...</p>