解决用户主页关注和粉丝问题
This commit is contained in:
parent
b71a19d53e
commit
9b97f7e472
|
@ -10,11 +10,7 @@ module Redmine
|
||||||
def acts_as_watchable(options = {})
|
def acts_as_watchable(options = {})
|
||||||
return if self.included_modules.include?(Redmine::Acts::Watchable::InstanceMethods)
|
return if self.included_modules.include?(Redmine::Acts::Watchable::InstanceMethods)
|
||||||
class_eval do
|
class_eval do
|
||||||
if self.name == 'User'
|
has_many :watchers, :as => :watchable, :dependent => :delete_all
|
||||||
has_many :watchers, :dependent => :delete_all
|
|
||||||
else
|
|
||||||
has_many :watchers, :as => :watchable, :dependent => :delete_all
|
|
||||||
end
|
|
||||||
has_many :watcher_users, :through => :watchers, :source => :user, :validate => false
|
has_many :watcher_users, :through => :watchers, :source => :user, :validate => false
|
||||||
|
|
||||||
scope :watched_by, lambda { |user_id|
|
scope :watched_by, lambda { |user_id|
|
||||||
|
|
Loading…
Reference in New Issue