Let's say you want
records = Model.all records.to_a.map{|m| m.serializable_hash(:root => true)}
just like to_json(:root => true) does
[ { "model": { "attribute_1": "value_1", "attribute_2": "value_2", } } ... ]
activerecord hash
hdorio Jun 13 '13 at 15:21 2013-06-13 15:21
source share