Skip to content

Instantly share code, notes, and snippets.

@joshuaclayton
Created January 6, 2009 15:18
Show Gist options
  • Save joshuaclayton/43850 to your computer and use it in GitHub Desktop.
Save joshuaclayton/43850 to your computer and use it in GitHub Desktop.
module WillPaginate
module ViewHelpers
def will_paginate_with_collection_check(*args)
# if args.first.respond_to?(:total_pages) doesn't work if using
# with a presenter, since the presenter probably uses method_missing to
# delegate method calls to the collection instance variable
if (args.first.total_pages rescue false)
will_paginate_without_collection_check(*args)
end
end
alias_method_chain :will_paginate, :collection_check
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment