title: wrong number of arguments (given 0, expected 1) in ransack scope
body: <p><a href="https://i.stack.imgur.com/Q9yIH.png" rel="nofollow noreferrer">I was getting this error</a></p>
  <p><strong>Controller</strong></p>
  <pre><code>def index
   @q = JobSubmission.ransack(search_params[:q])
   @job_submissions = @q.result(distinct: true)
   @job_submissions = @job_submissions.page(params[:page]).per(10)
  end
  </code></pre>
  <p>I created a association between Job and Job Submission</p>
  <p><strong>Job.rb model</strong></p>
  <pre><code>class Job &lt; ApplicationRecord
    has_many :job_submissions
  end
  </code></pre>
  <p><strong>JobSubmission.rb model</strong></p>
  <pre><code>class JobSubmission &lt; ApplicationRecord
    belongs_to :job
    scope :by_job, -&gt;(id) { includes(:job).where(jobs:{id: id}) }
  
    def self.ransackable_scopes(auth_object = nil)
      %i(by_job)
    end
  end
  </code></pre>
  <p><strong>Search form</strong></p>
  <pre><code>.search-panel
    %h4 Search File
    = search_form_for(@q, url:admin_job_submissions_path, method: :get, as: :q)  do |f|
      = f.label :by_job, &quot;Job:&quot;
      = f.collection_select(:by_job, Job.all, :id, :job_title, :include_blank =&gt; &quot;None&quot;)
  
      = f.submit 'Search' , class: &quot;button action-button__new-button&quot;
  </code></pre>
  <p><strong>I have 2 Jobs and 4 Job Submissions.</strong></p>
  <blockquote>
  <p>Job Collection</p>
  </blockquote>
  <pre><code>id: 1, job_title: &quot;Job 1&quot;
  id: 2, job_title: &quot;Job 2&quot;
  </code></pre>
  <blockquote>
  <p>Job Submission Collection</p>
  </blockquote>
  <pre><code>id: 1, job_id: 1, file: &quot;Job submission 1&quot;
  id: 2, job_id: 2, file: &quot;Job submission 2&quot;
  id: 3, job_id: 1, file: &quot;Job submission test to 1&quot;
  id: 4, job_id: 2, file: &quot;Job Submission test 2&quot;
  </code></pre>
  <p>I tested to run this code in my rails console.</p>
  <blockquote>
  <p>To search for Job Submission with the job id of 1.</p>
  </blockquote>
  <pre><code>irb(main):013:0&gt; JobSubmission.ransack({&quot;by_job&quot; =&gt; 1}).result
  Traceback (most recent call last):
          2: from (irb):13
          1: from app/models/job_submission.rb:6:in `block in &lt;class:JobSubmission&gt;'
  ArgumentError (wrong number of arguments (given 0, expected 1))
  </code></pre>
  <blockquote>
  <p>To search for Job Submission with the job id of 2.</p>
  </blockquote>
  <pre><code>irb(main):014:0&gt; JobSubmission.ransack({&quot;by_job&quot; =&gt; 2}).result
    SQL (1.0ms)  SELECT  &quot;job_submissions&quot;.&quot;id&quot; AS t0_r0, &quot;job_submissions&quot;.&quot;job_id&quot; AS t0_r1, &quot;job_submissions&quot;.&quot;file&quot; AS t0_r2, &quot;job_submissions&quot;.&quot;created_at&quot; AS t0_r3, &quot;job_submissions&quot;.&quot;updated_at&quot; AS t0_r4, &quot;jobs&quot;.&quot;id&quot; AS t1_r0, &quot;jobs&quot;.&quot;job_title&quot; AS t1_r1, &quot;jobs&quot;.&quot;published&quot; AS t1_r2, &quot;jobs&quot;.&quot;summary_html&quot; AS t1_r3, &quot;jobs&quot;.&quot;body_en_html&quot; AS t1_r4, &quot;jobs&quot;.&quot;body_ph_html&quot; AS t1_r5, &quot;jobs&quot;.&quot;created_at&quot; AS t1_r6, &quot;jobs&quot;.&quot;updated_at&quot; AS t1_r7 FROM &quot;job_submissions&quot; LEFT OUTER JOIN &quot;jobs&quot; ON &quot;jobs&quot;.&quot;id&quot; = &quot;job_submissions&quot;.&quot;job_id&quot; WHERE &quot;jobs&quot;.&quot;id&quot; = $1 LIMIT $2  [[&quot;id&quot;, 2], [&quot;LIMIT&quot;, 11]]
  =&gt; #&lt;ActiveRecord::Relation [#&lt;JobSubmission id: 2, job_id: 2, file: &quot;Job submission 2&quot;, created_at: &quot;2020-10-01 03:14:08&quot;, updated_at: &quot;2020-10-01 03:14:08&quot;&gt;, #&lt;JobSubmission id: 4, job_id: 2, file: &quot;Job Submission test 2&quot;, created_at: &quot;2020-10-01 03:56:10&quot;, updated_at: &quot;2020-10-01 03:56:10&quot;&gt;]&gt;
  </code></pre>
  <p>I tried also to update my gem ransack to master branch but still didnt fix the issue.
  Thank you for any help in advance.</p>