gpt4 book ai didi

ruby-on-rails - will_paginate 方法的问题

转载 作者:行者123 更新时间:2023-12-04 06:06:42 24 4
gpt4 key购买 nike

我正在尝试在我的 rails 应用程序中使用 will_paginate 进行分页。我正在关注 Michael Hartl 的 Rails 教程。
在我的 Controller 中,我有

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

在我看来我有
<%= will_paginate %>
<ul class="users">
<% @users.each do |user| %>
<li>
<%= gravatar_for user, size: 50 %>
<%= link_to user.name, user %>
</li>
<% end %>
</ul>
<%= will_paginate %>

它引发以下错误:will_paginate 的参数数量错误(给定 0,预期为 1)

最佳答案

有同样的问题。

更改为 3.1.7(从 Gemfile 中的 3.1.6)为我修复了它。

引用ArgumentError: wrong number of arguments (given 0, expected 1) #589

关于ruby-on-rails - will_paginate 方法的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55725399/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com