class NameObserver

Public Instance Methods

after_create(name) click to toggle source
# File app/models/observers/name_observer.rb, line 2
def after_create(name)
  case name.nameable
  when Person
    name.nameable.results.all.each do |result|
      if result[:name] != name.nameable.name(result.year)
        result.cache_attributes! :non_event
      end
    end
  when Team
    name.nameable.results.all.each do |result|
      if result[:team_name] != name.nameable.name(result.year)
        result.cache_attributes! :non_event
      end
    end
  end
  true
end