title: undefined method `model_name' for #Array when using pagy gem
body: <p>i got this problem:</p>
  <blockquote>
  <p>undefined method `model_name' for #Array:0x00007f3e929cc430</p>
  </blockquote>
  <pre><code>{ count:     collection.count(:all),
       page:      params[vars[:page_param]||Pagy::VARS[:page_param]],
       item_path: &quot;activerecord.models.#{collection.model_name.i18n_key}&quot; }.merge!(vars)
     end
  </code></pre>
  <p>here is my data_controller.rb:</p>
  <pre><code>  def index
      @pagy, @datas = pagy(Data.active_only.where(data_location: @location).sort_by(&amp;:id))
    end
  </code></pre>
  <p>here is my application_controller.rb</p>
  <pre><code>def pagy_get_vars(collection, vars)
      { count:     collection.count(:all),
       page:      params[vars[:page_param]||Pagy::VARS[:page_param]],
       item_path: &quot;activerecord.models.#{collection.model_name.i18n_key}&quot; }.merge!(vars)
     end
  </code></pre>
  <p>and lastly my view</p>
  <pre><code>&lt;div&gt;
  &lt;table id=&quot;tablestock&quot; class=&quot;table_content table&quot;&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;ID&lt;/th&gt;
        &lt;th&gt;Date&lt;/th&gt;
        &lt;th class=&quot;sorting_disabled&quot;&gt;Location&lt;/th&gt;
        &lt;th class=&quot;sorting_disabled&quot;&gt;Name&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
  
    &lt;tbody&gt;
      &lt;% @datas.each do |data| %&gt;
      &lt;tr data-link=&quot;&lt;%= data_path(data) %&gt;&quot;&gt; 
        &lt;td&gt;&lt;%= data.id %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= data.created_at.strftime('%d %b %Y') rescue (&quot;&lt;b style='color:red; font-size:16px;'&gt;ERROR&lt;/b&gt;&quot;.html_safe)%&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%=data.data_location.location if data.location_id? %&gt;&lt;/td&gt;
        &lt;td&gt;&lt;%= data.data_name.name if data.name_id? %&gt;&lt;/td&gt;
  
      &lt;/tr&gt;
      &lt;% end %&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
    &lt;div class=&quot;justify&quot;&gt;
      &lt;%= pagy_nav(@pagy).html_safe if @datas.present? %&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>