Skip to content

Instantly share code, notes, and snippets.

@iamvery
Created August 30, 2012 16:13
Show Gist options
  • Select an option

  • Save iamvery/3532052 to your computer and use it in GitHub Desktop.

Select an option

Save iamvery/3532052 to your computer and use it in GitHub Desktop.
Shows how one might set a default will_paginate link renderer in a rails application
module ApplicationHelper
# This method is overriding the view helper provided by `will_paginate`
def will_paginate(collection_or_options = nil, options = {})
options, collection_or_options = collection_or_options, nil if collection_or_options.is_a? Hash
options.merge! :renderer => YourCustomLinkRenderer unless options[:renderer]
super *[collection_or_options, options].compact
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment