gpt4 book ai didi

ruby-on-rails - 无法将 nil 转换为数组 will_paginate

转载 作者:行者123 更新时间:2023-12-03 16:12:55 25 4
gpt4 key购买 nike

大家好,我在 rails 3 中遇到了 will_paginate 的问题,我的 Controller 中有这个

@posts = Post.paginate(:all,
:include => [:author, :categories],
:conditions=>"status = 'published'",
:order=>"blog_posts.created_at DESC",
:per_page => 1, :page => params[:page])

和 <%= will_paginate @posts %> 在我看来,但我收到此错误无法不断将 nil 转换为 Array。

谁能帮我 ?

提前致谢

最佳答案

您需要安装 will_pagination 版本 3.0.pre2 才能在数据库级别而不是在数组上进行分页。

gem 'will_paginate', '3.0.pre2'

关于ruby-on-rails - 无法将 nil 转换为数组 will_paginate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4423941/

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