summaryrefslogtreecommitdiff
path: root/app/models/switchboard.rb
blob: 74e27672e53699da0445e43e88e77881eca5af3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class Switchboard < ActiveRecord::Base
  # https://github.com/rails/strong_parameters
  include ActiveModel::ForbiddenAttributesProtection

  validates :name,
            :presence => true,
            :uniqueness => {:scope => :user_id}

  belongs_to :user, :touch => true
  has_many :switchboard_entries, :dependent => :destroy
  has_many :sip_accounts, :through => :switchboard_entries

  def to_s
    self.name.to_s
  end
end