I want to get something like this to look nice:
>> ProductColor.all
=> [#<ProductColor id: 1, name: "White", internal_name: "White", created_at: "2009-06-10 04:02:44", updated_at: "2009-06-10 04:02:44">, #<ProductColor id: 2, name: "Ivory", internal_name: "Ivory", created_at: "2009-06-10 04:02:44", updated_at: "2009-06-10 04:02:44">, #<ProductColor id: 3, name: "Blue", internal_name: "Light Blue", created_at: "2009-06-10 04:02:44", updated_at: "2009-06-10 04:02:44">, #<ProductColor id: 4, name: "Green", internal_name: "Green", created_at: "2009-06-10 04:02:44", updated_at: "2009-06-10 04:02:44">]
This doesn't work:
>> ProductColor.all.inspect
=> "[#<ProductColor id: 1, name: "White", internal_name: "White", created_at: "2009-06-10 04:02:44", updated_at: "2009-06-10 04:02:44">, #<ProductColor id: 2, name: "Ivory", internal_name: "Ivory", created_at: "2009-06-10 04:02:44", updated_at: "2009-06-10 04:02:44">, #<ProductColor id: 3, name: "Blue", internal_name: "Light Blue", created_at: "2009-06-10 04:02:44", updated_at: "2009-06-10 04:02:44">, #<ProductColor id: 4, name: "Green", internal_name: "Green", created_at: "2009-06-10 04:02:44", updated_at: "2009-06-10 04:02:44">]"
And neither does this:
>> ProductColor.all.to_yaml
=> "---
- !ruby/object:ProductColor
attributes:
name: White
created_at: 2009-06-10 04:02:44
updated_at: 2009-06-10 04:02:44
id: "1"
internal_name: White
attributes_cache: {}
- !ruby/object:ProductColor
attributes:
name: Ivory
created_at: 2009-06-10 04:02:44
updated_at: 2009-06-10 04:02:44
id: "2"
internal_name: Ivory
attributes_cache: {}
- !ruby/object:ProductColor
attributes:
name: Blue
created_at: 2009-06-10 04:02:44
updated_at: 2009-06-10 04:02:44
id: "3"
internal_name: Light Blue
attributes_cache: {}
- !ruby/object:ProductColor
attributes:
name: Green
created_at: 2009-06-10 04:02:44
updated_at: 2009-06-10 04:02:44
id: "4"
internal_name: Green
attributes_cache: {}
"
Thoughts?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…