【发布时间】:2012-06-27 08:34:51
【问题描述】:
我搜索再搜索,但没有解决我的问题。这是我的控制器:
def show
@topic = Topic.find(params[:id])
@topic.posts = @topic.posts.page(params[:page]).per(2) # 2 for debugging
end
这功能很好,因为主题视图减少到两个帖子。但是,当我将此添加到 show.html.erb 时:
<%= paginate @topic.posts %>
我收到了这个错误:
undefined method `current_page' for #<ActiveRecord::Relation:0x69041c9b2d58>
【问题讨论】:
标签: ruby-on-rails ruby kaminari