title: Rails Scope for JSONB Hash with Array for Value
body: <p>I am using a JSONB column where the data is stored as { key => [value, value, value ] }
  How do I write a scope that returns records which contain a particular value in the array of a particular key?</p>
  
  <p>I've figured out how to search simple JSON Hashes;</p>
  
  <pre><code>scope :rice_flour, -&gt; { where("ingredients -&gt;&gt; 'flour' = ?", "rice") }
  </code></pre>
  
  <p>...but this query type still escapes me.  Everything I have looked up lays things out in raw SQL commands, and I am looking for how to write tidy Rails Scopes.</p>