X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/f07819d81a7437e58c6e64c2e76ba7e54fad9034..b3e540a6b6d9b9833ae57d9067774deb592c5164:/app/models/spam_observer.rb diff --git a/app/models/spam_observer.rb b/app/models/spam_observer.rb index 8b5212111..07fa84ffd 100644 --- a/app/models/spam_observer.rb +++ b/app/models/spam_observer.rb @@ -3,13 +3,13 @@ class SpamObserver < ActiveRecord::Observer def after_save(record) case - when record.is_a?(User): user = record - when record.is_a?(DiaryEntry): user = record.user - when record.is_a?(DiaryComment): user = record.user + when record.is_a?(User) then user = record + when record.is_a?(DiaryEntry) then user = record.user + when record.is_a?(DiaryComment) then user = record.user end if user.status == "active" and user.spam_score > SPAM_THRESHOLD - user.update_attributes(:status => "suspended") + user.update_column(:status, "suspended") end end end