X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/daa2496024cf0bdc65e58eb6e2802784f411f68b..eac26c9a2ca1a5fa3a85f1196416a7d324ba7663:/app/models/user_role.rb diff --git a/app/models/user_role.rb b/app/models/user_role.rb index efa540fec..4f80f1952 100644 --- a/app/models/user_role.rb +++ b/app/models/user_role.rb @@ -1,8 +1,8 @@ class UserRole < ActiveRecord::Base - - ALL_ROLES = ['administrator', 'moderator'] - - validates_inclusion_of :role, :in => ALL_ROLES belongs_to :user + belongs_to :granter, :class_name => "User" + + ALL_ROLES = %w(administrator moderator).freeze + validates :role, :inclusion => ALL_ROLES, :uniqueness => { :scope => :user_id } end