title: Ransack association scopes
body: <p>I am trying to use a scope from an association in a ransack filter; a <code>Contact</code> has_many <code>Surveys</code> through <code>Subscriptions</code>.  I created the Survey scope below:</p>
  
  <pre><code>scope :score_in, -&gt; (nps_type = nil) do
    where(score: NPS_RANGE[nps_type])
  end
  
  NPS_RANGE = {
     nil        =&gt; [*0..10],
    'detractor' =&gt; [*0..6],
    'passive'   =&gt; [7, 8],
    'promoter'  =&gt; [9, 10]
  }
  </code></pre>
  
  <p>Yet when I do <code>Contact.ransack(surveys_score_in: 'detractor')</code> it doesn't work and looks up based on <code>0</code> since <code>'string'.to_i == 0</code> instead of <code>[*0..6]</code>.</p>
  
  <p>I even defined <code>self.ransackable_scopes</code> to whitelist it as well but it still wasn't running. Any ideas on how to get Ransack to use this scope?</p>