i have a query in postgres that returns back a postgres array in one of the columns:
SELECT e.context->'device' AS device, count(e.data->'model_name') AS members, ARRAY_AGG(e.data->'model_name') AS models
FROM entity AS e
WHERE e.data->'type'='chassis' GROUP BY e.context->'device', e.data->'model_name';
is there a gem or serialize statement i could use to map the rails 3 model so that i could use models directly as a ruby array?
i know i could loop through it in the controller, but that seems not very DRY.
In case someone finds this and like me is looking to add support to a Rails 3.2 app I found the 1.0 version of postgres_ext gem.
The 1.0 version has a dependency on ActiveRecord 3.2.
Higher major versions are for use with Rails 4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With