I tried to use paginate in my controller:
@project_pages, @project = paginate :projects, :conditions => ["id =
?",
params[:id]], :per_page => 1
render :partial => "project", :locals => {:project =>
@project.first,
:project_pages => @project_pages}
But links in the partial are not displayed:
<%= link_to "Previous page", { :page =>
@project_pages.current.previous
} if @project_pages.current.previous %>
<%= link_to "Next page", { :page => @project_pages.current.next
} if
@project_pages.current.next %>
If :conditions in paginate method is used not for finding current
element, but for filtering elements from the set to be used for
paginator, then it would explain why previous/next links are not
displayed.
But if it''s true, then how get specified (by params[:id]) element and
use paginate to display previous/next links to proper elements?
--
Posted via http://www.ruby-forum.com/.