I have @result_pages and @results obtained from paginate in an action. I
want to show the pages as
1 | 2 | 3 | 4 >
The fifth page will show:
< 5 | 6 | 7 | 8 >
and so on.
How exactly do I render the paginator to give this effect? I guess I
will have to use pagination_links_each. But being new to Rails, I need
help.
will have to use pagination_links_each. But being new to Rails, I need
I wrote this helper for an application where pagination and ordering
were done through Ajax:
Returns the links to pages for paginated listings.
def pagination_links_remote(options={})
paginator = options[:paginator]
actions = []
1.upto(paginator.page_count) do |n|
if paginator[n] == paginator.current_page
actions << n.to_s
else
options[:url][:page] = n
actions << link_to_remote(n.to_s, options)
end
end
“[ #{actions.join(’ | ')} ]”
end