Rails3: model: replace deprecated validate method at member_role model
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8068 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
747afd8088
commit
1de2c1c2af
|
@ -25,8 +25,9 @@ class MemberRole < ActiveRecord::Base
|
||||||
after_destroy :remove_role_from_group_users
|
after_destroy :remove_role_from_group_users
|
||||||
|
|
||||||
validates_presence_of :role
|
validates_presence_of :role
|
||||||
|
validate :validate_role_member
|
||||||
|
|
||||||
def validate
|
def validate_role_member
|
||||||
errors.add :role_id, :invalid if role && !role.member?
|
errors.add :role_id, :invalid if role && !role.member?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue