Skip to content

Instantly share code, notes, and snippets.

@corny
Created April 14, 2012 21:56
Show Gist options
  • Save corny/2388053 to your computer and use it in GitHub Desktop.
Save corny/2388053 to your computer and use it in GitHub Desktop.
PaginationHelper for will_paginate
module PaginationHelper
# adds a pagination before and after the given block
def pagination(collection=nil, options={}, &block)
# no Collection given? then call collection method
collection ||= send :collection
pages = will_paginate(collection, options)
html = ''
html << pages if pages
html << capture(&block)
html << pages if pages
html.html_safe
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment