How do I paginate activities for a given project In my routes file I have
resources :projects do
resources :activities
end
在我的活动中,控制者(是否在我的项目控制人中?)
def index
@project = current_user.projects.find(params[:project_id])
@activities = @project.activities.all.paginate(:per_page => 5, :page => params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @activities }
end
end
我的看法
<%= will_paginate @project.activities %>
然而,没有回过错,但书表中却缺少想象力。 任何想法?