Apparently I didn't try all the option combinations. This got me what I needed.
many_to_many :fields, join_table: :templates, right_key: :id, right_primary_key: :template_id, left_primary_key: :template_id, left_key: :id On Saturday, July 8, 2017 at 9:39:25 PM UTC-4, Adam Daniels wrote: > > I'm stuck on getting this many_to_many return the # of records I expect. > I've determined it's related to the type of JOIN, and the condition in the > WHERE. > > Could anybody give me a hand? I've gone through docs+multiple options and > not sure what I might have missed. The SQL I expect (and works manually) is > at bottom of gist in comment. > > https://gist.github.com/adam12/dd4620a927b882bdc445777110a8a081 > > Thanks. > -- 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 sequel-talk+unsubscr...@googlegroups.com. To post to this group, send email to sequel-talk@googlegroups.com. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.