Forum: Ruby on Rails update parent in assocation callback

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Grayson P. (Guest)
on 2008-12-11 20:42
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

    def update_latest_peep(peep)

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.

This topic is locked and can not be replied to.