Created
April 14, 2012 21:56
-
-
Save corny/2388053 to your computer and use it in GitHub Desktop.
PaginationHelper for will_paginate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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