]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user_role.rb
Allow any valid (per RFC 3986) scheme name in OAuth callback URLs
[rails.git] / app / models / user_role.rb
index efa540fec851de209b0a7d9d4fa74b63a60ab10d..fb783281ed81dfa10cd5098d7c861bdc432f5455 100644 (file)
@@ -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