1 class SpamObserver < ActiveRecord::Observer
2 observe User, DiaryEntry, DiaryComment
6 when record.is_a?(User) then user = record
7 when record.is_a?(DiaryEntry) then user = record.user
8 when record.is_a?(DiaryComment) then user = record.user
11 if user.status == "active" and user.spam_score > SPAM_THRESHOLD
12 user.update_column(:status, "suspended")