Module: Redmine::Acts::Watchable::ClassMethods
- Defined in:
- vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb
Instance Method Summary
Instance Method Details
- (Object) acts_as_watchable(options = {})
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'vendor/plugins/acts_as_watchable/lib/acts_as_watchable.rb', line 10 def acts_as_watchable( = {}) return if self.included_modules.include?(Redmine::Acts::Watchable::InstanceMethods) send :include, Redmine::Acts::Watchable::InstanceMethods class_eval do has_many :watchers, :as => :watchable, :dependent => :delete_all has_many :watcher_users, :through => :watchers, :source => :user named_scope :watched_by, lambda { |user_id| { :include => :watchers, :conditions => ["#{Watcher.table_name}.user_id = ?", user_id] } } attr_protected :watcher_ids, :watcher_user_ids end end |