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

Fix rendering of ActiveRecord::Relation

Now renders as array rather than huge, complex object.
Tested with Rails 3.0.3 - but should be good with any newer version too.
(cherry picked from commit 88d7128f18e478a7c0d6a425ac3032771fd2c4fa)
This commit is contained in:
Dan Lynn 2012-07-06 22:50:19 -04:00 committed by Mike Dvorkin
parent ac3f7cb60b
commit 1ed20e1fbe
2 changed files with 3 additions and 0 deletions

1
.gitignore vendored
View file

@ -20,3 +20,4 @@ pkg
## PROJECT::SPECIFIC ## PROJECT::SPECIFIC
.rvmrc .rvmrc
.idea

View file

@ -21,6 +21,8 @@ module AwesomePrint
cast = :active_record_instance cast = :active_record_instance
elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base) elsif object.is_a?(Class) && object.ancestors.include?(::ActiveRecord::Base)
cast = :active_record_class cast = :active_record_class
elsif type == :activerecord_relation
cast = :array
end end
cast cast
end end