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?
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!