Skip to content

Instantly share code, notes, and snippets.

@wireframe
Created June 8, 2012 18:55
Show Gist options
  • Save wireframe/2897567 to your computer and use it in GitHub Desktop.
Save wireframe/2897567 to your computer and use it in GitHub Desktop.
# BAD: opening up the original class and defining/redefining methods
class ActiveRecord::Base
def my_monkey_patch
end
end
# GOOD: extracting custom logic and *injecting* into core class
module MyCustomLogic
extend ActiveSupport::Concern
def my_monkey_patch
end
end
ActiveRecord::Base.send :include, MyCustomLogic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment