From: Dr Nic Date: 2006-08-16T23:00:31+09:00 Subject: Re: Dr Nic’s Magic Models Christian Neukirchen wrote: > Dr Nic writes: > >>> BTW? >> >> It generates a has_one if your method name is singular. >> >> E.g. >> >> @person.membership - has_one >> @person.memberships - has_many >> >> So much magic in one place! :) > > Whoa, ouch. :-P That's right, please stand behind the police line. > A very simple and trying-to-be-completely-unmagic-but-clever ORM I've > been writing recently makes relationships based on foreign keys. If > the field referenced is declared "unique", it will be like has_one, > else like has_many. Of course, my system was made for non-legacy and > well-specified database schemata. Cool. I've been working on adding foreign key support (generically, but will require per-vendor extensions) that should be released soon for the MMs. The "unique" idea is interesting. I'll have a think about that one. Cheers Nic -- Posted via http://www.ruby-forum.com/.