Association proxies to other associations
Reported by Sam Smoot | May 8th, 2008 @ 06:32 PM | in 0.9.0
Basically because we don't return Arrays anymore,
Zoo.exhibits.map { |e| e.animals.entries }.flatten.compact
Gets kinda ugly with the .entries in there. I'd like to see a feature from DM 0.3.x make it into 0.9.x that allows you to:
Zoo.exhibits.animals
To accomplish the same.
Comments and changes to this ticket
-
Dan Kubb May 8th, 2008 @ 06:39 PM
This is exactly the sort of thing I was thinking about for the Collection to handle. Since its lazy, and I want to make it store the Query object internally (instead of just a closure around the DOA reader stuff), I think this is totally doable.
The DM::Query::Path stuff would be created with the above example, but I don't see that as a problem long term. We could make it so Collection does double-duty as a lazy array (which it does now), and as a replacement for DM::Query::Path provided it can be introspected to figure out the :links that should be used in the Query it's passed to.
-
Sam Smoot May 9th, 2008 @ 11:03 AM
- → Assigned user changed from Dan Kubb to Adam French
Until we can discuss your plans Dan, we'll just take the easy way out for now and add a method to handle the map/flatten/compact of associations to Collection.
Adam, PDI sir, PDI.
-
Adam French May 10th, 2008 @ 03:32 PM
so we can now go one association deep
Post.all.categoriesBut the setup isn't optimal and iterates over #entries rather than smartly loading the associations with 1 call to the data-store.
Still though, it's close
-
Adam French May 20th, 2008 @ 09:36 PM
- → State changed from new to resolved
I guess I never marked this resolved. Here goes....
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
