Skip to content

Instantly share code, notes, and snippets.

@itspriddle
Created January 14, 2014 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itspriddle/8419831 to your computer and use it in GitHub Desktop.
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`
# 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