My current setup is that a discussion has many posts. Thus, the show action of discussions shows a list of posts.
discussions/show.html.erb:
<% for post in @discussion.posts %>
<div class="post" id="<%= post.id %>">
<div class="post-content">
<div class="post-user">
<div class="name"><%= link_to post.user.username, post.user %></div>
</div>
<div class="post-body">
<%= post.content %>
</div>
</div>
</div>
<% end %>
And this is my discussions_controller show action:
def show
@forum = Forum.find_by_permalink(params[:forum_id])
@discussion = Discussion.find(params[:id])
end
Every time I attempt to add the paginate method to my view, I get a series of errors. I know I’m stepping on the wrong foot here, so where should I start to be able to get paginate working for this page?
Many thanks in advance, still somewhat new to Rails!
change
to
Your view would then be
Then you’d add the paginate code in the view