Update parent in assocation callback

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)
self.latest_peed_id= peep.id

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 forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs