1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
class GsNode < ActiveRecord::Base
attr_accessible :name, :ip_address, :site, :element_name, :push_updates_to, :accepts_updates_from
has_many :phone_numbers, :foreign_key => :gs_node_id, :dependent => :destroy
has_many :users, :foreign_key => :gs_node_id, :dependent => :destroy
has_many :sip_accounts, :foreign_key => :gs_node_id, :dependent => :destroy
has_many :hunt_groups, :foreign_key => :gs_node_id, :dependent => :destroy
validates :name,
:presence => true
validates :ip_address,
:presence => true
validates :site,
:presence => true
validates :element_name,
:presence => true
def to_s
name
end
def synced
self.last_sync = Time.now
return self.save
end
end
|