当我在标签2上并点击例如第3页时,它刷新页面然后我回到标签1.我的猜测是我需要AJAX来解决这个问题,但我可以使用一些帮助这一点。
之前我尝过一些例子,但都没有。
请帮我解决这个问题。提前谢谢!
控制器:
class ProfilesController < ApplicationController
def show
@fullname = current_user.first_name + " " + current_user.last_name
@recipes = current_user.recipes.page(params[:recipes_page]).order("created_at DESC")
@favorites = current_user.favorites.page(params[:favorites_page]).order("created_at DESC")
end
end
在我看来:
<div class="apple_pagination">
<%= will_paginate @recipes, param_name: "recipes_page" %>
</div>
<div class="apple_pagination">
<%= will_paginate @favorites, param_name: "favorites_page" %>
</div>
答案 0 :(得分:1)
试试这个:
<div class="apple_pagination">
<%= will_paginate @recipes, :remote => true , param_name: "recipes_page" %>
</div>
<div class="apple_pagination">
<%= will_paginate @favorites, :remote => true , param_name: "favorites_page" %>
</div>