I'm probably just missing something simple here, but after spending a bunch 
of time looking at the association_basics documentation and digging through 
StackOverflow, I still can't puzzle this one out.

I have a table that I need to join onto itself. The join uses 3 keys. 

I've gotten the join to work with code like:

DB[:ps_acad_prog___a].join(:ps_acad_prog___b, [[:a__emplid, :b__emplid], 
[:a__acad_career, :b__acad_career], [:a__stdnt_car_nbr, 
:b__stdnt_car_nbr]]).where("a.effdt <= ?", Time.now)


But I'd like to move to using Sequel::Model. Something like

PsAcadProg < Sequel::Model
  #magic join code
end

Obviously I'm stuck on that 'magic join code' line. Most of my attempts 
have looked something like:

class PsAcadProg < Sequel::Model(:ps_acad_prog)
  many_to_many :acad_progs,
    :left_key => [:emplid, :acad_career, :stdnt_car_nbr],
    :right_key => [:emplid, :acad_career, :stdnt_car_nbr],
    :join_table => self
end

And the error I'm getting is:

Sequel::Error: mismatched number of left keys: [:emplid, :acad_career, 
:stdnt_car_nbr] vs []
Version/Platform Details:
  Ruby: 2.1.1
  Sequel version: 4.9.0
  Database: Oracle (I'm connecting with ruby-oci8 2.1.7)


Any thoughts?

Thanks,

Ian

-- 
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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to