Created
June 8, 2012 18:55
-
-
Save wireframe/2897567 to your computer and use it in GitHub Desktop.
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
# 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