Hi, I'm trying to do some more elaborated queries with datamapper, but I'm having some difficulties.
# Group By I tried to count all my Addresses group by their Users (A User can have many addresses) The result would be something like: [[Jack DMObject, 3], [Maria DMObject, 4], [Nina DMObject, 2]] An array of arrays, with the datamapper object and the count. From what I read in the docs, It seems that you can only count a given object, not group them. http://datamapper.org/docs/find # Subselect Select most recent addresses for each user. select a.* from address a where a.creation_date = (select max(sub.creation_date) from address sub where sub.id_user = a.id_user) The question here is: How to correlate subqueries? # Eager Loading This last one could be a mapping error, but I tried to load a single Company.all.each do | company | company.employees.each do |emploee| print employee.address # this is always nil end end I searched in the group, and looks like there are other guys out there with problem to load deep graphs of objects. -- You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en.
