1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

hack to support finding AR::B classes

sigh. this needs to be done way better.
This commit is contained in:
James Cox 2019-01-23 14:19:35 -05:00
parent 7ace70b774
commit da29f748f2

View file

@ -123,7 +123,13 @@ module AwesomePrint
# base class.
#---------------------------------------------------------------------------
def printable(object)
object.class.to_s.gsub(/:+/, '_').downcase.to_sym
# FIXME: rails specific hack. this needs to be extracted into a
# awesome_print-rails binding lib or something.
if defined?(::ActiveRecord) && object.respond_to?(:ancestors) && object.ancestors.to_a.include?(::ActiveRecord::Base)
:activerecord_base_class
else
object.class.to_s.gsub(/:+/, '_').downcase.to_sym
end
end
# Update @options by first merging the :color hash and then the remaining