Ah, and as soon as I post the question, I find the answer. I'm annoyed
because I've used `naked` heaps in previous projects. It's just been a
while I suppose *palm to forehead*
MyModel.naked.all
On Wednesday, 24 August 2016 16:15:23 UTC+10, Tom Wardrop wrote:
>
> 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.