projects
/
rails.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Cope with MESSAGES_DOMAIN not being defined
[rails.git]
/
app
/
models
/
user_role.rb
diff --git
a/app/models/user_role.rb
b/app/models/user_role.rb
index efa540fec851de209b0a7d9d4fa74b63a60ab10d..fb783281ed81dfa10cd5098d7c861bdc432f5455 100644
(file)
--- a/
app/models/user_role.rb
+++ b/
app/models/user_role.rb
@@
-1,8
+1,8
@@
class UserRole < ActiveRecord::Base
+ belongs_to :user
ALL_ROLES = ['administrator', 'moderator']
validates_inclusion_of :role, :in => ALL_ROLES
- belongs_to :user
-
+ validates_uniqueness_of :role, :scope => :user_id
end