Kaminari 无输出
我正在尝试使用 kaminari (0.13.0) 对模型进行分页,但我无法让分页助手显示任何内容。
在我看来,
# show.haml
= paginate @jobs
# @jobs.class => ActiveRecord::Relation
我使用 rails g kaminari:config
生成了配置文件,并使用 rails g kaminari:views default
生成了默认视图。
也没有显示任何错误。
编辑
其他一些辅助方法的输出:
# show.haml
= paginate @jobs
# no output
= link_to_previous_page @jobs, "Prev"
# undefined method `link_to_previous_page' for #<#<Class:0xb12818a4>:0xac737c4>
= link_to_next_page @jobs, "Next"
# no output
= page_entries_info @jobs
# Displaying <b>1</b> job
I'm trying to paginate a model using kaminari (0.13.0), but I can't get the paginate helper to display anything.
In my view,
# show.haml
= paginate @jobs
# @jobs.class => ActiveRecord::Relation
I've generated a configuration file using rails g kaminari:config
and default views using rails g kaminari:views default
.
No errors are being displayed either.
edit
The output from some of the other helper methods:
# show.haml
= paginate @jobs
# no output
= link_to_previous_page @jobs, "Prev"
# undefined method `link_to_previous_page' for #<#<Class:0xb12818a4>:0xac737c4>
= link_to_next_page @jobs, "Next"
# no output
= page_entries_info @jobs
# Displaying <b>1</b> job
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的期望是不正确的。当在只有一条记录的
ActiveRecord::Relation
上调用paginate
帮助器时,我期望 Kaminari 以纯文本形式输出Prev 1 Next
。按照 DeathHammer 的建议添加更多记录,现在可以正确输出nav
。My expectations were incorrect. I was expecting Kaminari to output
Prev 1 Next
in plain text when thepaginate
helper was called on aActiveRecord::Relation
with only one record. Adding more records, as suggested by DeathHammer, now correctly outputs thenav
.