Hi J Here is the pastie. http://pastie.org/601790
I think if I only understood how to get the graph_conditions to be applied .. ( the ones you suggested are the correct ones ) when I use eager_graph, this would work, but I am not sure why they are not used? ~ Daniel > > I tried your suggestions ( added graph_only_conditions, no dice .. > > here is result sequel for the > > Horse.eager_graph(:dude).first ( same result as with > > Horses.eager_graph(:dude).limit(1).all.first ) > > Horse.eager_graph(:dude).first won't do what you want. It'll return a > graph of results instead of an array of horses that already have the > dude association set. You need to call .all if you are going to be > doing any eager loading. > > > > > > > SELECT `HORSES`.`NAME`, `HORSES`.`KID - DATE`, `HORSES`.`KID - TIME`, > > `HORSES`.`KID - USER`, `HORSES`.`KID - MULT`, `HORSES`.`KID - COMM`, > > `HORSES`.`DUDE KID - DATE`, `HORSES`.`DUDE KID - TIME`, `HORSES`.`DUDE > > KID - USER`, `HORSES`.`DUDE KID - MULT`, `HORSES`.`DUDE KID - COMM`, > > `DUDE`.`KID - DATE` AS `DUDE_KID - DATE`, `DUDE`.`KID - TIME` AS > > `DUDE_KID - TIME`, `DUDE`.`KID - USER` AS `DUDE_KID - USER`, > > `DUDE`.`KID - MULT` AS `DUDE_KID - MULT`, `DUDE`.`KID - COMM` AS > > `DUDE_KID - COMM`, `DUDE`.`NAME` AS `DUDE_NAME`, `DUDE`.`RANCH CODE` > > FROM `HORSES` LEFT OUTER JOIN `DUDES` AS `DUDE` ON ((`KID - DATE`, > > `KID - TIME`, `KID - USER`, `KID - MULT`, `KID - COMM`) IS NULL) LIMIT > > 1 > > > the join sql is messed up after the LEFT OUTER JOIN ... ON part. > > I did read that part on the advanced associations you were talking > > about, and it was confusing. I will try again though. > > If you can pastie a self-executing example, I'll look into this more > tomorrow. > > > Yes, you are right, for getting one record, its no big deal ( I am > > just trying to give super simple example so I can learn ) , but in > > reality I will be getting many records, and a few joins to various > > other tables at the same time, and it will make huge difference then. > > OK. Just making sure. Some people think that queries are so > expensive that you never want 2 when 1 will do. You are correct that > it can make a huge difference for large datasets. > > Jeremy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
