hello again,
i’m trying to paginate comments with will_paginate in order, newest on
top, and i’m using the sample script from acts_as_commentable in my
controller:
def add_comment
commentable_type = params[:commentable][:commentable]
commentable_id = params[:commentable][:commentable_id]
# Get the object that you want to comment
commentable = Comment.find_commentable(commentable_type,
commentable_id)
# Create a comment with the user submitted content
comment = Comment.new(params[:comment])
# Assign this comment to the logged in user
comment.user_id = current_user
# Add the comment
commentable.comments << comment
redirect_to :action => "show",
:id => commentable_id
end
as well as :
def show_comment
@post = Post.paginate :per_page =>10, :page => params[:page],
:order => “DESC”
end
i have a partial that shows just the comments to the post
<%= @post.comments%>
<%= will_paginate @post.comments %>
and i get this msg:
undefined method `page_count’ for #Class:0x4a7601c
so my question is how do i paginate comments for specific posts?
thank you guys!