Will Paginate pagination helper

Tagged will_paginate, pagination, helper  Languages ruby
module ApplicationHelper
  def paginate(collection)
    if collection.previous_page && !collection.next_page
      will_paginate collection, :page_links => true, :next_label => "", :prev_label => "« Previous"
    elsif collection.next_page && !collection.previous_page
      will_paginate collection, :page_links => true, :next_label => "Next »", :prev_label => ""
    else
      will_paginate collection, :page_links => true, :next_label => "Next »", :prev_label => "« Previous"
    end
  end
end