I thought this would be straightforward, but I'm missing something

class User < AR::Base
  has_one :profile, :dependent => :destroy
end

class Profile < AR::Base
  belongs_to :user
end

Based on a field change in User, I want to update and save some values
in Profile.

So, I have this in User:

def after_validation_on_update
  if self.userType_changed?
    self.some_local_field = '' # this works
    self.profile.field_x = '' # this not being changed
    self.profile.save # needed?
  end
end

The fields in User (self) are being updated just fine. But I can't seem
to force the changes to fields in User.profile.

Stopping at the gas station for directions...

Thx
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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