@@ -21,6 +21,7 class Watcher < ActiveRecord::Base | |||
|
21 | 21 | |
|
22 | 22 | validates_presence_of :user |
|
23 | 23 | validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id] |
|
24 | validate :validate_user | |
|
24 | 25 | |
|
25 | 26 | # Unwatch things that users are no longer allowed to view |
|
26 | 27 | def self.prune(options={}) |
@@ -37,7 +38,7 class Watcher < ActiveRecord::Base | |||
|
37 | 38 | |
|
38 | 39 | protected |
|
39 | 40 | |
|
40 | def validate | |
|
41 | def validate_user | |
|
41 | 42 | errors.add :user_id, :invalid unless user.nil? || user.active? |
|
42 | 43 | end |
|
43 | 44 |
General Comments 0
You need to be logged in to leave comments.
Login now