Paul,

DB[:a].join_table(:left, :b, [:a__id => :b__id, :b__foo =>
@some_dynamic_query_value]).filter(:a__foos => 'ball')

Michael

On Wed, Aug 29, 2012 at 11:33 PM, Paul Lamb <[email protected]> wrote:
> It's been a while since I've done sequel and I just wanted to check and see
> if it was possible to do something (hopefully fairly cleanly) that seems
> almost impossible to do in activerecord without going n+1. Given models a
> and b, a has many b, I need to be able to generate a query like:
>
> SELECT * FROM a LEFT OUTER JOIN b ON a.id = b.id AND b.foo =
> @some_dynamic_query_value WHERE a.foos = 'ball';
>
> It's that second condition on the join with a dynamic value that needs to
> get set and passed into the query. The ultimate goal is to keep it from
> turning into a n+1 situation. I also haven't come up with a good set of
> google query terms to find any previous threads that match this.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/sequel-talk/-/zCV8K81P60kJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sequel-talk?hl=en.



-- 
http://codeconnoisseur.org

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to