mislav / will_paginate

Pagination library for Rails and other Ruby applications
http://github.com/mislav/will_paginate/wikis
MIT License
5.7k stars 864 forks source link

Conflict between two paginations #499

Closed katafira closed 8 years ago

katafira commented 8 years ago

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 %>

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!

katafira commented 8 years ago

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