On Tuesday, August 22, 2017 at 5:15:48 PM UTC-7, Tom Wardrop wrote:
>
> I'm basically after something like #to_json, but which obviously returns a 
> standard Ruby hash instead of a JSON string. #to_json allows you to easily 
> :include associations and other fields. Is there anything like that for 
> Ruby hashes?
>

to_json now takes a block yielding the object that would be converted to 
JSON. You can now do something like:

def hash_with_foo
  to_json(:include=>:foo){|hash| return hash}
end

The graph_each extension works on a dataset, not on a model object, and it 
uses separate subhashes for each table (not just for associated tables), so 
it won't work for what you want.

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

Reply via email to