So I wrote this and then realized I didn't explain it clearly enough and 
couldn't edit it, sorry. I know about the to_hash method, but if I'm 
returning multiple objects (in an array) I'd like to return the hashed 
representation of each of them. I was able to do it by doing 
sequel_results.map {|x| x.to_hash} but I didn't know if there was a 
convenience method for that so I didn't have to write the map part every 
time. Something along the lines of object.all.hashed_results

On Tuesday, March 17, 2015 at 8:09:58 AM UTC-7, Jeremy Evans wrote:
>
> On Tuesday, March 17, 2015 at 8:01:13 AM UTC-7, Jon Mattingly wrote:
>>
>> I'm sorry if this is a dumb question, but is there a simple way to get a 
>> ruby array of the values mapped to a Sequel::Model object without having to 
>> manually construct it? I'm using Grape with Sequel and it is just returning 
>> the Sequel object.
>>
>
> If you just want the hash of values for a Sequel::Model instance, call 
> #to_hash.  I'm not sure why you would need an array of just the values 
> without the keys, but to_hash.values should work for that, at least on ruby 
> 1.9+ where hashes are ordered.
>
> Thanks,
> Jeremy
>

-- 
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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to