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:
parent
7ace70b774
commit
da29f748f2
1 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue