summaryrefslogtreecommitdiffstats
path: root/app/models/watcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/watcher.rb')
-rw-r--r--app/models/watcher.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/models/watcher.rb b/app/models/watcher.rb
index 8ea457060..15bfaa6db 100644
--- a/app/models/watcher.rb
+++ b/app/models/watcher.rb
@@ -19,7 +19,7 @@
class Watcher < ActiveRecord::Base
belongs_to :watchable, :polymorphic => true
- belongs_to :user
+ belongs_to :user, :class_name => 'Principal'
validates_presence_of :user
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]
@@ -54,7 +54,8 @@ class Watcher < ActiveRecord::Base
protected
def validate_user
- errors.add :user_id, :invalid unless user.nil? || user.active?
+ errors.add :user_id, :invalid \
+ unless user.nil? || (user.is_a?(User) && user.active?) || (user.is_a?(Group) && user.givable?)
end
def self.prune_single_user(user, options={})