Hi
 I am trying to eager load an association which is linked by composite
key.  Lets say I have a models like these.

DB_DEMO.create_table! :dudes do
  Integer :'kid - date'
  Integer :'kid - time'
  Integer :'kid - user'
  String  :'name'
  Integer :'ranch code'
end

DB_DEMO.create_table! :horses do
  String  :'name'
  Integer :'kid - date'
  Integer :'kid - time'
  Integer :'kid - user'
  Integer :'dude kid - date'
  Integer :'dude kid - time'
  Integer :'dude kid - user'
end

class Dude < Sequel::Model(:dudes)
  set_primary_key [:'kid - date',:'kid - time',:'kid - user']
end

class Horse < Sequel::Model(:horses)
  set_primary_key [:'kid - date',:'kid - time',:'kid - user']
  many_to_one( :dude, :key=>nil, :class => Dude, :dataset=> proc
{ Dude.filter( :"kid - date"=>self[:"dude kid - date"], :"kid -
time"=>self[:"dude kid - time"], :"kid - user"=>self[:"dude kid -
user"]) } )
end

 I want to do something like
  Horses.first.dude
 and not do two queries to get the associated dude, but have the one
query do the join when it loads the horse.

I have tried playing around with :eager and :eager_graph ( I read the
docs but they were alittle confusing) , yet have not quite gotten it
working.

~ Daniel
--~--~---------~--~----~------------~-------~--~----~
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