I feel I'm missing something obvious here. How do I get an array of hashes
from a model? The closest I could find is `to_hash`, but is there any way I
can get all the results as an array of hashes instead of an array of model
instances?
Below are examples of #all, #to_hash and my imaginary #to_a which
illustrates the result I'm after; an array of hashes, just like a plain old
dataset returns.
MyModel.all #=> [#<MyModel>, #<MyModel>, ...]
MyModel.to_hash #=> {1 => { ... }, 2 => { ... }}
MyModel.to_a #=> [{ ... }, { ... }]
Cheers
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.