title: Filter array in rails with postgres
body: <p>I am struggling with filtering of an object in Rails 4.2.5 and Postgres.
  At this moment I have lots of filters designed like this:</p>
  
  <pre><code>scope :occasions, -&gt; (occasions) { where('occasions @&gt; ?', "{#{occasions}}") }
  scope :rating, -&gt; (rating) { where('rating &gt; ?', "#{rating}") }
  </code></pre>
  
  <p>Now I want to do more advanced object filtering for time and price. The object is stored in the database as an array (maximum size 48) like this:</p>
  
  <pre><code>time_slots = [null, null, null, 1500, 1500, 2000, 2000, 2500]
  </code></pre>
  
  <p>The above means that the person is not available on time slot 1, 2 and 3 and for next time slot the person costs 2000, etc.</p>
  
  <p>I would like to filter on minTime, maxTime, minPrice and maxPrice.</p>
  
  <p>Does anybody have any suggestions?</p>