title: How can I match a partial string to a database's object's attribute? Regexp?
body: <p>I have a database containing a list of movies. A typical entry look like this:</p>
  
  <pre><code>id: 1, 
  title: "Manhatten and the Murderer", 
  year: 1928, 
  synopsis: 'some text...' 
  rating: 67, 
  genre_id, etc. etc.
  </code></pre>
  
  <p>Now I'm trying to make a series of search tests pass and so far I have made a single test case pass where if you type the title "Manhatten and the Murderer" in a text field it will find the movie that you want. The problem is with partial matching. </p>
  
  <p>Now I'd like a way to search "Manhat" and match the record "Manhatten and the Murderer". I also want it to match with any movie that has "Manhat" in it. For example, it would return maybe 2 or 3 others like title: "My life in Manhattan", title: "The Big Apple in Manhattan" etc. etc.</p>
  
  <p>Below is the code that I have so far in my Movie model:</p>
  
  <pre><code>def self.search(query)
  # Replace this with the appropriate ActiveRecord calls...
  
  if query =~ where(title:)
    #where(title: query)
    binding.pry
  end
  
  
  end
  </code></pre>
  
  <p>My question is, how can I set this up? My problem is the "where(title:) line. One thought was to use Regexp to match the title attribute. Any help would be appreciated! Thanks.</p>