diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/conference.rb | 4 | ||||
-rw-r--r-- | app/models/sip_account.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/models/conference.rb b/app/models/conference.rb index 8c5a752..aee75d5 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -31,7 +31,7 @@ class Conference < ActiveRecord::Base validate :start_and_end_dates_must_make_sense, :if => Proc.new { |conference| !conference.start.blank? && !conference.end.blank? } - after_save :send_pin_email_when_pin_has_changed + before_save :send_pin_email_when_pin_has_changed default_scope where(:state => 'active').order(:start) @@ -55,7 +55,7 @@ class Conference < ActiveRecord::Base end def send_pin_email_when_pin_has_changed - if self.conferenceable.class == User && self.pin_changed? + if !self.new_record? && self.conferenceable.class == User && self.pin_changed? Notifications.new_pin(self).deliver end end diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb index 2040b41..5660e37 100644 --- a/app/models/sip_account.rb +++ b/app/models/sip_account.rb @@ -38,7 +38,7 @@ class SipAccount < ActiveRecord::Base has_many :ringtones, :as => :ringtoneable, :dependent => :destroy - has_many :calls, :finder_sql => lambda { |s| "SELECT DISTINCT detailed_calls.* FROM detailed_calls WHERE presence_id LIKE '#{self.auth_name}@%'" } + has_many :calls, :finder_sql => lambda { |s| "SELECT DISTINCT detailed_calls.* FROM detailed_calls WHERE presence_id LIKE '#{self.auth_name}@%' OR b_presence_id LIKE '#{self.auth_name}@%'" } # Delegations: # |