2

Here is another Newbie question on Rails 3: I have a model called "Activity". On the show.html.erb page of an activity, I show the comments that belong to this activity as a partial:

<%= render :partial => @activity.comments %>

How the comments look like is in the _comment.html.erb file.

My question: How can I paginate the comments for an activity with Kaminari?

Thanks very much in advance!

The_Fritz
  • 452
  • 3
  • 17

1 Answers1

-1

Lets assume params[:page] is the page number for your comments. You would do something like @activity.comments.page(params[:page]). I suggest you read https://github.com/amatsuda/kaminari, the README contains pretty much everything you need.

ksol
  • 11,835
  • 5
  • 37
  • 64
  • I read the README and didn't find a solution yet. What I don't understand: Where is the information you usually find in the controller when you use partials? For example, for the pagination of the activities i entered `@activities = Activity.page params[:page]` in the activities_controller, so the view would know which page to display. – The_Fritz Feb 17 '12 at 22:31