Unfortunately this is mySQL

On Fri, Aug 31, 2018, 22:05 Jeremy Evans <[email protected]> wrote:

> On Friday, August 31, 2018 at 4:08:02 PM UTC-7, Elanor Riley wrote:
>>
>> I can do that this weekend.
>>
>> I guess the other question is, is this the best way to accomplish this? I
>> tried using association_join instead but to_json failed because of the
>> extra attributes from the User model mixed with the Order model.
>>
>
> Using eager/eager_graph to eagerly load the associations and then the
> :include to_json option is the the recommended way if you want separate
> hashes for the associated objects.
>
> If you are using PostgreSQL, since you are only including a single column
> value for each associated object, you could probably be more efficient by
> using array_agg (and the pg_array extension), though that will change the
> generated JSON.  If there are issues specific to eager/eager_graph usage
> with to_json, that should avoid them.
>
> Thanks,
> Jeremy
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sequel-talk" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sequel-talk/CxASW9C-JcA/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

-- 
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