I searched and searched, but nothing solved my problem. Here's my controller:
def show
@topic = Topic.find(params[:id])
@topic.posts = @topic.posts.page(params[:page]).per(2) # 2 for debugging
end
That functions just fine, because the topic view is reduced to two posts. However, when I add this to show.html.erb:
<%= paginate @topic.posts %>
I'm given this error:
undefined method `current_page' for #<ActiveRecord::Relation:0x69041c9b2d58>
Try with:
def show
@topic = Topic.find(params[:id])
@posts = @topic.posts.page(params[:page]).per(2)
end
And then:
<%= paginate @posts %>