summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-26 16:22:52 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-26 16:22:52 +0100
commite2e2fbbdc6b26e00101f5d4d1b05c0d076c817c2 (patch)
tree9bcee822e17e416dbf012f180d0abcdd309b6c51 /app/models
parentaf4a02e15a02481e23f9458ae0a430ec52c57417 (diff)
Add a bit of AJAX to remove the just deleted row in call_history#index
Diffstat (limited to 'app/models')
-rw-r--r--app/models/call_history.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/models/call_history.rb b/app/models/call_history.rb
index 4db056a..81342bd 100644
--- a/app/models/call_history.rb
+++ b/app/models/call_history.rb
@@ -3,6 +3,9 @@ class CallHistory < ActiveRecord::Base
belongs_to :caller_account, :polymorphic => true
belongs_to :callee_account, :polymorphic => true
belongs_to :auth_account, :polymorphic => true
+
+ validates :start_stamp,
+ :presence => true
def display_number
if self.entry_type == 'dialed'
@@ -78,10 +81,11 @@ class CallHistory < ActiveRecord::Base
end
def display_call_date(date_format, date_today_format)
- if self.start_stamp.strftime('%Y%m%d') == DateTime::now.strftime('%Y%m%d')
+ if self.start_stamp.to_date == Date.today
return self.start_stamp.strftime(date_today_format)
+ else
+ return self.start_stamp.strftime(date_format)
end
- return self.start_stamp.strftime(date_format)
end
def display_duration
@@ -129,6 +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