------ art_19328_3900974.1182997908614 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline ok, gents, your comments are well heeded. I am still a newbie here and a mess is not what i want to try to fix later when i am already in production with this and want to fix it. thanks, will keep looking shawn On 6/27/07, dblack / wobblini.net <dblack / wobblini.net> wrote: > > Hi -- > > On Thu, 28 Jun 2007, Giles Bowkett wrote: > > > On 6/27/07, Ball, Donald A Jr (Library) <donald.ball / nashville.gov> > wrote: > >> > ok, i will look that up. I am not looking to build a rails > >> > app with this, i want to build a GUI app where our customers > >> > can point different attributes to different models ( kinda > >> > like setting a foriegn key dynamically, we are dealing with > >> > lots of models here. So, i suppose i could store them in a > >> > configuration file or something. > >> > >> 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. > >> > >> Either sound more reasonable than mucking about with monkey-patching > the > >> class at run-time. Not nearly as much fun, mind you, but that's not > >> always the best thing for which to optimize. > > > > You can do that: > > > > Foo.class_eval("has_many :bars") > > I think you could just do: > > Foo.has_many :bars > > However... > > > 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. > > ...I totally agree about the heinous mess :-) > > > David > > -- > * Books: > RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) > RUBY FOR RAILS (http://www.manning.com/black) > * Ruby/Rails training > & consulting: Ruby Power and Light, LLC (http://www.rubypal.com) > > ------ art_19328_3900974.1182997908614--