diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
commit | b80bd744ad873f6fc43018bc4bfb90677de167bd (patch) | |
tree | 072c4b0e33d442528555b82c415f5e7a1712b2b0 /app/models/gs_node.rb | |
parent | 3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff) |
Start of GS5.
Diffstat (limited to 'app/models/gs_node.rb')
-rw-r--r-- | app/models/gs_node.rb | 30 |
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 |