Created
January 14, 2014 15:12
-
-
Save itspriddle/8419831 to your computer and use it in GitHub Desktop.
Fixes an issue with AwesomePrint and ActiveRecord 3 abstract models (https://github.com/michaeldv/awesome_print/pull/147). Drop it in `~/.irbrc`
This file contains hidden or 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
# Work around for https://github.com/michaeldv/awesome_print/pull/147 | |
AwesomePrint::ActiveRecord.send :include, Module.new { | |
def awesome_active_record_class_with_fix(object) | |
return awesome_class(object) if object.respond_to?(:abstract_class?) && object.abstract_class? | |
super(object) | |
end | |
def self.included(base) | |
base.class_eval do | |
alias_method :awesome_active_record_class_without_fix, :awesome_active_record_class | |
alias_method :awesome_active_record_class, :awesome_active_record_class_with_fix | |
end | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment