mislav/will_paginate

Conflict between two paginations

Closed this issue · 1 comments

Hello, I'm Kata, and I need some help here. So thanks in advance.
So I have two pagination, one for users, and one for offspring. The deal is that when i try to go to any page of the offspring list the view jumps to users, though the offspring page is saved properly. This is not my own code, I have to correct it and I can't figure it out. I have them in the same view, btw, and also separately, and changing offspring page always jumps to users first, and I have to go to offspring again to see the intended page. Is it because of will_paginate or should I look elsewhere?

The view

<%= will_paginate @users, :previous_label => "Previo", :next_label => "Siguiente", :param_name => :users_page %>

<%= will_paginate @offsprings, :previous_label => "Previo", :next_label => "Siguiente", :param_name => :offsprings_page %>
        <div class="panel panel-default">

            <div class="list-group list-view-pf">
              <%= render @offsprings %>

          </div>
        </div>

<%= will_paginate @offsprings, :previous_label => "Previo", :next_label => "Siguiente", :param_name => :offsprings_page %>
<%= render partial: 'shift_view', collection: @rooms, as: :room %>
<%= render partial: 'system_admin_view' %>
<%= render partial: 'system_admin_dashboard_view' %>

The controllers

class UsersController < ApplicationController
def show
@user = User.find_by_id(params[:id]) || current_user
end

def index
@users = User.paginate(page: params[:page])
end

class AdminController < ApplicationController
layout 'admin'
before_action :admin_user?

def dashboard
@users = User.paginate(page: params[:users_page])
@offsprings = Offspring.paginate(page: params[:offsprings_page])
@rooms = Room.all
@users_count = User.where(admin: false).count

end

class OffspringsController < ApplicationController
def show
@offsprings = Offspring.paginate(page: params[:offsprings_page])
end

Sorry for such a long post!
Cheers!

Closed due to inability to find the problem. Used datatables pagination instead.