From: shawn bright Date: 2007-06-28T05:25:54+09:00 Subject: Re: ActiveRecord (not necessarily rails) ------=_Part_16981_25726224.1182975956496 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline no, i am sorry, i was not clear enough. is there a way, programatically, that i change the behavior of a model while still using the model. is there a way to make it change behavior from has_many :records to has_many :hats on the fly. like is there a variable i can pass to an active record object to make it change behavior ? thanks sk On 6/27/07, Igor Sutton Lopes wrote: > > Hi, > > On Jun 27, 2007, at 4:05 PM, shawn bright wrote: > > > Hello all, > > i have been using ActiveRecord in a couple of GUI applications > > recently and > > it is working really well. > > i was wondering though, if it is possible to have a class defined > > that i can > > change one of the has_many or belongs_to declarations > > dynamically. In a model, i declare one like this. > > > > class Person ActiveRecord::Base > > has_many :records > > > > now, is the has_many some sort of attribute, class variable, etc... > > i mean if in my program, i wanted to change the > > has_many :records to something like > > has_many :hats > > > has_many :hats, :class_name => 'Record', :foreign_key => 'hat_id' > > > Good luck! > > -- > Igor Sutton > igor.sutton@gmail.com > > > > > ------=_Part_16981_25726224.1182975956496--