X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/09c5740b5bb94c75a5c8c83cdbb80ae7b5ccbdf4..6e12650a453461d8c98c17c82f70d1a0f2df3940:/app/models/user_role.rb diff --git a/app/models/user_role.rb b/app/models/user_role.rb index efa540fec..9686f7250 100644 --- a/app/models/user_role.rb +++ b/app/models/user_role.rb @@ -1,8 +1,7 @@ class UserRole < ActiveRecord::Base - - ALL_ROLES = ['administrator', 'moderator'] - - validates_inclusion_of :role, :in => ALL_ROLES belongs_to :user + ALL_ROLES = %w(administrator moderator) + + validates :role, :inclusion => ALL_ROLES, :uniqueness => { :scope => :user_id } end