简体   繁体   English

will_paginate当前页面始终为1

[英]will_paginate current page is always 1

Im using will_paginate and the problem Im having is when I click on a specific page number in the will_paginate selection. 我正在使用will_paginate ,而我在will_paginate选择中单击特定页码时遇到的问题是。 The page reloads with the page=2 if clicking 2 on the selection for example. 例如,如果在选项上单击2 ,则页面将以page=2重新加载。 However on the selection it is still selected as page 1 . 但是,在选择时仍将其选择为第1页。 The selection never changes. 选择永远不会改变。

在此处输入图片说明

 <%= will_paginate @reservations %> 

I removed the css from the pagination and still having the same problem. 我从分页中删除了CSS,但仍然遇到相同的问题。

@reservations = user.reservations.order(updated_at: :desc).page(params[:page_pending]).per_page(10)

also tried: 还尝试了:

@reservations = user.reservations.order(updated_at: :desc).paginate(page: params[:page_pending]).per_page(10)

请在Controller->“索引操作”中将查询更改为此吗?

@reservations = user.reservations.order(updated_at: :desc).paginate(page: params[:page], per_page: 30)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM