On Tuesday, August 29, 2017 at 3:32:41 PM UTC-7, Aryk Grosz wrote:
>
> Thanks for the clarification. I agree regarding the PRs you suggested, 
> specifically on documenting this fact.
>
> The problem is when I read this 
> <https://github.com/jeremyevans/sequel/blob/master/lib/sequel/plugins/dataset_associations.rb#L46>
>  I 
> thought dataset_associations_join would solve all problems and include 
> dynamic conditions based on other columns in other tables (since it was now 
> joining).
>

The intention was that if you are selecting, ordering, or filtering 
manually, you'd want to use the option instead of doing the joins manually. 
 Here's an example:

Foo.many_to_many :bars
Foo.bars.where{bars_foos[:baz] =~ 1}

The documentation doesn't specifically state it doesn't use the association 
conditions when joining and only uses them in the subselect to filter the 
records, and maybe something along that lines should be added.

I gave more thought on supporting the :graph options, but I don't think it 
will work, at least not directly.  When graphing using the above example 
(e.g. Foo.eager_graph(:bars)), you are going from foos->bars_foos->bars, 
while with dataset associations, you would have to go bars->bars_foos->foos.

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