diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-12-04 09:45:18 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2011-12-04 09:45:18 +0000 |
commit | bddd19c1e662e6e5565ec1b2968b2907780c35de (patch) | |
tree | 57fc8faae95a07c1b03d183cf13ffea0ca8af42f /app/models/watcher.rb | |
parent | 93603f383aca6eb75d3d6ce8b2892a6eaa4e13ac (diff) | |
download | redmine-bddd19c1e662e6e5565ec1b2968b2907780c35de.tar.gz redmine-bddd19c1e662e6e5565ec1b2968b2907780c35de.zip |
Rails3: model: replace deprecated validate method at watcher model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8072 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/watcher.rb')
-rw-r--r-- | app/models/watcher.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/watcher.rb b/app/models/watcher.rb index de111185a..c42b55f5f 100644 --- a/app/models/watcher.rb +++ b/app/models/watcher.rb @@ -21,6 +21,7 @@ class Watcher < ActiveRecord::Base validates_presence_of :user validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id] + validate :validate_user # Unwatch things that users are no longer allowed to view def self.prune(options={}) @@ -37,7 +38,7 @@ class Watcher < ActiveRecord::Base protected - def validate + def validate_user errors.add :user_id, :invalid unless user.nil? || user.active? end |