1 class SpamObserver < ActiveRecord::Observer
2 observe User, DiaryEntry, DiaryComment
6 when record.is_a?(User): user = record
7 when record.is_a?(DiaryEntry): user = record.user
8 when record.is_a?(DiaryComment): user = record.user
11 if user.status == "active" and user.spam_score > APP_CONFIG['spam_threshold']
12 user.update_attributes(:status => "suspended")