diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/pager_group.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/pager_group.rb b/app/models/pager_group.rb index 5c9c6ad..5c91ed8 100644 --- a/app/models/pager_group.rb +++ b/app/models/pager_group.rb @@ -1,5 +1,6 @@ class PagerGroup < ActiveRecord::Base attr_accessible :sip_account_id, :callback_url + attr_writer :pager_group_destination_ids has_many :pager_group_destinations, :dependent => :destroy belongs_to :sip_account @@ -9,6 +10,14 @@ class PagerGroup < ActiveRecord::Base after_create :call before_destroy :hangup_all + before_save :save_pager_group_destination_ids + + def save_pager_group_destination_ids + if @pager_group_destination_ids + self.pager_group_destination_ids = @pager_group_destination_ids.split(/,/).map { |sip_account_id| self.pager_group_destinations.build(:sip_account_id => sip_account_id) } + end + end + def identifier "pager#{self.id}" end |