class TeamObserver

Public Instance Methods

after_destroy(team) click to toggle source
# File app/models/observers/team_observer.rb, line 2
def after_destroy(team)
  Result.update_all [ "team_id=?, team_name=?", nil, nil ], [ "team_id=?", team.id ]
  true
end
after_update(team) click to toggle source
# File app/models/observers/team_observer.rb, line 7
def after_update(team)
  if team.name_changed?
    team.results.all.each do |result|
      if result.team_name != team.name(result.year)
        result.cache_attributes! :non_event
      end
    end
  end
  true
end