diff options
author | Peter Kozak <spag@golwen.net> | 2013-05-17 09:34:20 +0200 |
---|---|---|
committer | Peter Kozak <spag@golwen.net> | 2013-05-17 09:34:20 +0200 |
commit | b46ab80284a50575dd7078b9958ce3be21acc594 (patch) | |
tree | 49ad8b46e643b695d2da80861751407c3cbc76ba /app | |
parent | 02f217c4a93de7f042f38584b5aa6b2a2bae869e (diff) |
voicemail_message method in call_history
Diffstat (limited to 'app')
-rw-r--r-- | app/models/call_history.rb | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/app/models/call_history.rb b/app/models/call_history.rb index 81342bd..8ccf4e3 100644 --- a/app/models/call_history.rb +++ b/app/models/call_history.rb @@ -133,19 +133,14 @@ class CallHistory < ActiveRecord::Base end - def voicemail_message? - begin - return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).any? - rescue - return nil - end - end - def voicemail_message - begin - return self.call_historyable.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first - rescue - return nil + if self.callee_account_type.downcase == 'voicemailaccount' + voicemail_account = VoicemailAccount.where(:id => self.callee_account_id).first + if voicemail_account + return voicemail_account.voicemail_messages.where(:forwarded_by => self.caller_channel_uuid).first + else + return nil + end end end |