I suppose this is not a pagination issue. Handling the params [: month] value for a query is something other than switching page offsets. You may not need a swap library for this.
How easy is it to create these links like this?
controller:
@posts = Post.by_month(Time.parse(params[:month]) || Time.now)
View:
<% Post.only(:created_at).map {|p| p.created_at.to_date.beginning_of_month}.uniq.sort.each do |m| -%> <%= link_to_unless_current m, :month => m %> <% end -%>
Of course, you can combine this query with a normal pagination if necessary. But page links should not be confused with month links in this case.
Akira Matsuda
source share