Skip to content

Instantly share code, notes, and snippets.

@itspriddle itspriddle/irbrc.rb
Created Jan 14, 2014

Embed
What would you like to do?
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
You can’t perform that action at this time.