On Thursday, January 28, 2016 at 2:33:40 PM UTC-8, binarypaladin wrote:
>
> So, right now, if I do something like this:
>
> ds = Model.eager_graph(:association) it... well... does the eager graph 
> thing. Yay.
>
> However if I then do this: ds.eager_graph(:association) it doubles down on 
> that association, more or less selecting everything twice. Is there a way 
> to look at a dataset and derive what associations are being eager graphed?
>

Well, ds.opts[:eager_graph] gives you the metadata related to eager 
graphing.  For simple cases:

  ds.opts[:eager_graph][:requirements].include?(:association_name)

may work, but note that the keys in that hash are table aliases, not 
association names (the default table alias is the association name, 
though).  Hopefully that gets you the information you want.  If not, please 
let me know and explain your use case, we can probably add additional 
metadata in that case.

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