openstreetmap-website/app/models/user_role.rb
Andy Allan c55169659c Add a user_role factory
Naming the association in the model makes the relationship easier
to express in the factory.
2017-02-02 12:35:29 +00:00

8 lines
237 B
Ruby

class UserRole < ActiveRecord::Base
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