# == Schema Information
#
# Table name: unities
#
#  id                  :integer          not null, primary key
#  role_id             :integer
#  user_id             :integer
#  location_network_id :integer
#  current_network     :string(255)
#  created_at          :datetime
#  updated_at          :datetime
#  permission          :string(255)
#

class Unity < ActiveRecord::Base
  belongs_to :role
  belongs_to :locatable, polymorphic: true
  belongs_to :user

  scope :only_full_permission, ->(role_id) { where(permission: 'full', role_id: role_id) }
  scope :only_limited_permission, ->(role_id) { where(permission: 'limited', role_id: role_id) }
end
