]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user_role.rb
Fix style issues found by new rubocop version
[rails.git] / app / models / user_role.rb
index efa540fec851de209b0a7d9d4fa74b63a60ab10d..9686f7250bdc7234173dad784686811420422594 100644 (file)
@@ -1,8 +1,7 @@
 class UserRole < ActiveRecord::Base
 class UserRole < ActiveRecord::Base
-
-  ALL_ROLES = ['administrator', 'moderator']
-
-  validates_inclusion_of :role, :in => ALL_ROLES
   belongs_to :user
 
   belongs_to :user
 
+  ALL_ROLES = %w(administrator moderator)
+
+  validates :role, :inclusion => ALL_ROLES, :uniqueness => { :scope => :user_id }
 end
 end