summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb b/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb
index 19af8e56c..4bbba854a 100644
--- a/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb
+++ b/lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb
@@ -40,12 +40,16 @@ module Redmine
# Adds user as a watcher
def add_watcher(user)
+ # Rails does not reset the has_many :through association
+ watcher_users.reset
self.watchers << Watcher.new(:user => user)
end
# Removes user from the watchers list
def remove_watcher(user)
return nil unless user && user.is_a?(User)
+ # Rails does not reset the has_many :through association
+ watcher_users.reset
watchers.where(:user_id => user.id).delete_all
end