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

ArrayFormatter now returns arrays for has_many :through associations

The array_formatter was always returning  an empty array when associated
objects were called via a `has_many through:` relationship because they
are loaded as a collection, and the collection is always considered
empty.

resolves: https://github.com/awesome-print/awesome_print/issues/331
This commit is contained in:
Chad Heinen 2018-02-03 18:11:08 -06:00
parent b95767e16b
commit 3b052a4f5e
2 changed files with 2 additions and 2 deletions

View file

@ -1,5 +1,5 @@
## master (unreleased) ## master (unreleased)
- new things! - ArrayFormatter now returns arrays for has_many :through associations [@chadh13] - [#332]
## 1.8.0 ## 1.8.0
- stat("$HOME/.aprc") once [@kstephens] - [#304] - stat("$HOME/.aprc") once [@kstephens] - [#304]

View file

@ -12,7 +12,7 @@ module AwesomePrint
end end
def format def format
if array.empty? if array.length.zero?
'[]' '[]'
elsif methods_array? elsif methods_array?
methods_array methods_array