Class User << ActiveRecord::Base
  has_one :profile
  delgate  :description, :description=, :to => :profile

end


I'd like to do,

@user = User.create(:name => 'Foo Bar', :description => 'Slow.')
or
@user = User.update_attributes(:description => 'Slow')

and have AR create/update the profile model and association (if it
doesn't already exist).


How can I do this?  Ideally this would be handled in User's
initialize, or callback, but I can't get anything to work.  When
reaching the delegate statement I get an error that profile is nil.

Thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to