class PersonObserver

Public Instance Methods

after_destroy(person) click to toggle source
# File app/models/observers/person_observer.rb, line 2
def after_destroy(person)
  Result.update_all [ "person_id=?, name=?, first_name=?, last_name=?", nil, nil, nil, nil ], [ "person_id=?", person.id ]
  true
end
after_update(person) click to toggle source
# File app/models/observers/person_observer.rb, line 7
def after_update(person)
  if person.first_name_changed? || person.last_name_changed?
    person.results.all.each do |result|
      if result[:name] != person.name(result.year)
        result.cache_attributes! :non_event
      end
    end
  end
  true
end