summaryrefslogtreecommitdiff
path: root/app/models/gs_node.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/gs_node.rb')
-rw-r--r--app/models/gs_node.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/models/gs_node.rb b/app/models/gs_node.rb
new file mode 100644
index 0000000..229ceb2
--- /dev/null
+++ b/app/models/gs_node.rb
@@ -0,0 +1,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