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