3 ms·
This works predates Rails 3 by about 2 or 3 years. I would bet it indirectly influenced AR3, and I know it has influenced DataMapper (which I maintain). One ma
by dkubb 16y ago
This works predates Rails 3 by about 2 or 3 years. I would bet it indirectly influenced AR3, and I know it has influenced DataMapper (which I maintain).
One major difference with Ambition is that you're writing the queries in the same code you would when using the normal Enumerable API. IMHO from an interface pov, it's better than any Ruby ORM has provided (or would ever be able to). However, the (big) downside is that it requires ParseTree, which only works on Ruby 1.8. It's also a bit fragile, since if you use code the underlying parser doesn't understand you'll get weird runtime errors.
I created an Ambition-like interface to DataMapper early last year, which uses a similar approach:
http://github.com/dkubb/dm-ambition/
The main difference (aside from working with DataMapper) is that when the underlying collection is already lazy loaded the block provided is evaluated for each record using the normal Enumerable methods. I believe the Ambition project has a few constructs that make this impossible, but in dm-ambition I set this as a requirement from the start.
- kunley 16y agoVery interesting. Thanks for the explanation. My hacker colleague who lives on the edge with DataMapper says Ambition-like stuff is to be included in DM. Is that related to your gem or a completely different activity?
- grandalf 16y agoFor anyone who isn't already using DM, you should be. Thanks Dan!