Browse Source

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
tags/1.4.0
Toshi MARUYAMA 12 years ago
parent
commit
bddd19c1e6
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      app/models/watcher.rb

+ 2
- 1
app/models/watcher.rb View File



validates_presence_of :user validates_presence_of :user
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id] validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]
validate :validate_user


# Unwatch things that users are no longer allowed to view # Unwatch things that users are no longer allowed to view
def self.prune(options={}) def self.prune(options={})


protected protected


def validate
def validate_user
errors.add :user_id, :invalid unless user.nil? || user.active? errors.add :user_id, :invalid unless user.nil? || user.active?
end end



Loading…
Cancel
Save