Re: setting attributes of associated models - best practice?

2008-12-09 Thread Ed W
[EMAIL PROTECTED] wrote: i read the AS documentation and found that it recommends creating a virtual attribute in household.rb, of the form: def name #{self.user.name} end so far so good... now i want to be able to update household.user.name when updating a household. so, i

Re: setting attributes of associated models - best practice?

2008-12-09 Thread G. Sobrinho
I **think** the best method is: def name #{self.user.name} end def first_name= name self.user.first_name = name end def before_save self.user.save! end Because it save the user only on you save the household... Regards, Sobrinho On 09-12-2008 11:29, Ed W wrote: [EMAIL PROTECTED]

setting attributes of associated models - best practice?

2008-12-04 Thread [EMAIL PROTECTED]
I have 2 models: :households (belongs_to: user) :users (has_many :households) :user has an attribute, name. when using active scaffold to list households, i'd like to show a column that is household.user.name i read the AS documentation and found that it recommends creating a virtual