I have
class Users < ActiveRecord::Base
belongs_to :team, touch: true
end
class Team < ActiveRecord::Base
has_many :users
before_save :update_popularity
before_update :update_popularity
def popularity
#secret algorythm
end
private
def update_popularity
# This is not called
end
end
User.first.name = 'John'
When I save a user I would like to update the team popularity as well. However the before_filter doesn't seem to be invoked?
Is there any proper way for doing this?