[Nitro] Og update

craig duncan craig-duncan at earthlink.net
Fri Apr 22 10:39:01 EDT 2005

George Moschovitis wrote:
> Can you explain more what you want? An advantage of Og over AR is that
> it automatically creates the correct schema for the associations (or
> Relations as they are called in Og). The same happens with Mixins. For
> example, Og automatically creates the table columns to support the
> nested_sets pattern, thus fully encapsulating the pattern.
> -g.

a) i want something that's documented (reasonably well) so that even if the way to 
use the feature is not entirely obvious or maybe even a little difficult, i can still 
manage it without tearing my hair out.  Also, the difficulty (over what i could 
accomplish more simply) should be worth the effort.

b) if i can't easily (enough) figure out how a certain (powerful) feature works and i 
know that what i want should be easily doable, then there should be some alternate, 
probably not as powerful, but easy to grasp, mechanism for accomplishing roughly the 
same thing.

So, with ActiveRecord, what i've wanted to do is select (via multiple joins) fields 
from a number of tables... not one by one but in a single query that hits the 
database just once and returns a single result (this is exactly what i would do if i 
were working directly in sql).  In principle this seems very simple to me, and i 
perfectly well understand how to write the sql.  My (fuzzier) notion of how this data 
will be returned to me (since it doesn't map to any individual db table) was some 
mechanism that would allow me to create a class with members giving me access to each 
field returned from the query.  Maybe i should use a view but i've been resisting 
that idea because i'm not clear how updates would work and AR, in this instance, 
would be providing me with nothing but the most limited capability and so... why bother?

Further, i have just run into the situation where one of my ancillary tables is 
selected from via *two* key fields in my main table.  So far, with AR, i know of no 
(non-kludgy) way of doing this, nor have i yet received any answer from the Rails 
mailing list.

Overall, what i want to do is really *quite* simple.  I have a very normalized set of 
tables.  And yet it is proving (to me) amazingly difficult to even understand the 
approach i'm supposed to take with AR regarding these various issues (which is, 
admittedly, pretty much a documentation problem).

As far as what you've said about automatically creating the Relations, i have no idea 
how this would work, so i can't say if it would provide the means to do what i'm 
trying to do.


P.S.  After looking at such a lot of really poor documentation (not from the 
standpoint of what's expected from an IBM reference manual, but from virtually any 
other) i've had the thought of volunteering to write documentation... if someone 
would be willing to *explain* to me how the thing to be documented works 
(iteratively, of course).  It's a truism but anyone who knows how something works too 
well and/or learned it too long ago, is virtually incapable of doing good 
documentation, because they skip over too much that is so obvious to them that it 
exists beneath the level of conscious awareness.

More information about the Nitro-general mailing list