I have a rails app and I’m trying to set up pagination for a view of the Essays class. I’m new to rails… so I can do this for ALL of them, but I only want certain ones to be in this list (where all the essays are contained in Essay.find(Ranking.where(:user_id=>current_user.id).essay_id)).
home.html.erb contains (among other things):
`<%= will_paginate @essays%>
<ul class="users">
<%= render @essays %>
</ul>
<%= will_paginate @essays%>`
in the Pages Controller:
def home
#...
@essays = Essay.paginate(:page => params[:page])
end
I tried adding @essays=Essay.find(Ranking.where(:user_id=>current_user.id).essay_id) before the @essays=Essay.paginate(:page => params[:page]) but the method essay_id for the Ranking class is not available here. How do I get around this? Thanks!
This should work: