From: Todd Benson Date: 2007-07-01T12:14:46+09:00 Subject: Re: ActiveRecord (not necessarily rails) On 6/27/07, Giles Bowkett wrote: > On 6/27/07, Ball, Donald A Jr (Library) wrote: > > I suspect you'd be much happier if these related attributes inherited > > from the same supermodel and used single-table inheritance, or if you > > used polymorphic associations instead. The latter sounds like it's more > > appropriate to your situation, but if your attribute models have similar > > characteristics, the former would be a better fit. > You can do that: > > Foo.class_eval("has_many :bars") > > But I think it could be an utterly heinous mess. You'd need the DB to > morph in an equivalently dynamic way, which is nontrivial. > To shawn: I haven't used ActiveRecord yet, but there are probably ways of changing the database schema 'on the fly', as it were. Just be careful, is all. Ruby will take care of semantics and leave the database in tact if that's all you are worried about, but you also then tread on dangerous waters. You're sort of asking for a dynamic model. Lot's of overhead involved. Todd