Hi,
I''m using the code below to display some pagination links. It works
great apart from when there''s no paging i.e. the full collection is
displayed, when it still display a "1" to represent the current page.
How can I suppress that?
Thanks!
<div class="pager">
<%= link_to(''< Prev'', {:params =>
params.merge(''page'' =>
@my_pages.current.previous)}, {:class => "prevlink"}) if
@my_pages.current.previous %>
<% for page in @my_pages -%>
<%= link_to_unless(params[:page].to_i == page.number, page.number,
{:params => params.merge(''page'' => page)},
{:class => "pagelink"}) {|link_name|
"<span
class=\"currentpage\">#{link_name}</span>"} %>
<% end %>
<%= link_to(''Next >'', {:params =>
params.merge(''page'' =>
@my_pages.current.next)}, {:class => "nextlink"}) if
@my_pages.current.next %>
</div>
--
Posted via http://www.ruby-forum.com/.