As somebody who's done some of this work (I wrote Lafcadio), I
strongly recommend that you consider extending somebody else's work
before doing it yourself. When you enter this problem domain there are
a lot of little wrinkles you run into, and the best solution isn't
always necessarily obvious from the start. I know that personally it
took me a while to figure out the best way to transparently handle
relations between different rows, for example.

Now, I've only used Lafcadio, but I have the feeling that right now
the Ruby OR-mapping tools out there are either 1) strong on mapping
rows to objects, or 2) strong on ad-hoc querying, but not both. I'd
put Lafcadio and Vapor in category 1, and Criteria in category 2.
Either requirement is pretty big; both are twice as big. In the
long-term, my feeling is that any library that sticks around in this
space will have to satisfy both needs.

In the short-term, I can tell you what you'd have to do for Lafcadio
to get it do what you want. First, Lafcadio was written first for
MySQL, and although it should support Postgres with minimal changes, I
have yet to implement or test such a change. (At RubyConf Ryan Davis
told me he was very interested in helping add Postgres functionality,
and I moved the library to DBI to enable that, but I suspect that,
like everybody else, Ryan's pretty busy.) Second, Lafcadio's support
for querying works, but I'll be the first to admit that it's verbose
and ugly as hell. Query inference is very high on my list, but then,
I'm busy, too. So Vapor or Criteria might be a better choice for you,
depending.

At the least you might want to poke around in the various libraries
and steal the best ideas for yourself.

Francis
 

Tim Bates <tim / bates.id.au> wrote in message news:<20040107121053.GB7464 / bates.id.au>...
> 
> I don't know if there is a solution to my problem, whether what I want
> can be done cleanly. To tell the truth I'm not 100% certain of what I
> want, but I visualise something like a cross between Vapor and Criteria.
> If no such thing exists, and I can't find an alternate solution I guess
> I'm back to writing it myself, or settling for some other method. It
> just seems like there should be a good way to marry the power of SQL
> (and the optimised searching/indexing and concurrency routines a good
> RDBMS provides) with the pristine Object-Orientedness of Ruby.