# Update parent in assocation callback

**URL:** <https://www.ruby-forum.com/t/update-parent-in-assocation-callback/155438>\
**Category:** Rails\
**Created:** [December 11, 2008, 7:42pm UTC](https://www.ruby-forum.com/t/update-parent-in-assocation-callback/155438 "2008-12-11T19:42:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![grayson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/c77e96/32.png) [@grayson](https://www.ruby-forum.com/u/grayson)\
**Post date:** [December 11, 2008, 7:42pm UTC](https://www.ruby-forum.com/t/update-parent-in-assocation-callback/155438/1 "2008-12-11T19:42:54Z")

</div>

I’d like to update an attribute on the parent using an association  
callback. For example

class User \< ActiveRecord::Base  
has\_many :peeps, :after\_add =\> :update\_latest\_peep

protected  
def update\_latest\_peep(peep)  
self.latest\_peed\_id= peep.id  
end  
end

If I debug and step through the code, I see that @owner (which is the  
user in question) actually does have that attribute set however when the  
code exists, it doesn’t seem to save.

Thanks.
