]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user_role.rb
Ensure that issue comments have associated issues and users.
[rails.git] / app / models / user_role.rb
index c4d703530220bac59cc59f9f96b5db47e7213227..967850145f838b4dcff1af82858235dbcecebec7 100644 (file)
@@ -1,8 +1,8 @@
 class UserRole < ActiveRecord::Base
   belongs_to :user
+  belongs_to :granter, :class_name => "User"
 
-  ALL_ROLES = %w(administrator moderator)
+  ALL_ROLES = %w[administrator moderator].freeze
 
-  validates_inclusion_of :role, :in => ALL_ROLES
-  validates_uniqueness_of :role, :scope => :user_id
+  validates :role, :inclusion => ALL_ROLES, :uniqueness => { :scope => :user_id }
 end