【发布时间】:2020-05-05 14:03:04
【问题描述】:
class Service
include Mongoid::Document
include Mongoid::Search
include Mongoid::Pagination
field :name, type: String
end
我的控制器
@services = Service.where(active: true).per_page(10)
宝石mongoid-pagination
index.html.erb
<% paginate @services %>
问题
未定义的方法 `total_pages' 用于
文件 https://github.com/ajsharp/mongoid-pagination
我需要解决分页问题。
【问题讨论】:
-
你能分享你的模型代码吗@carlos-lima
-
class Service include Mongoid::Document include Mongoid::Search include Mongoid::Pagination field :name, type: String
-
如果是测试项目,是否可以提供链接?,您也可以尝试
@services = Service.per_page(10)并发布输出。
标签: ruby-on-rails ruby pagination mongoid