Skip to content

Instantly share code, notes, and snippets.

@xntrik
Created November 12, 2011 01:11
Show Gist options
  • Save xntrik/1359842 to your computer and use it in GitHub Desktop.
Save xntrik/1359842 to your computer and use it in GitHub Desktop.
Smarter ruby method overloading using alias_method
http://www.leonardoborges.com/writings/2008/08/07/why-i-like-ruby-1-alias_method/
module ActiveRecord
class Base
alias_method :find_with_ferret_original, :find_with_ferret
def find_with_ferret(q, options = {}, find_options = {})
remove_diatrictics!(q)
find_with_ferret_original(q, options, find_options)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment