summaryrefslogtreecommitdiff
path: root/app/models/cdr.rb
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-06-22 10:25:31 +0200
committerPeter Kozak <spag@golwen.net>2013-06-22 10:25:31 +0200
commit130e77d4c9df2cca2425b63a443ea8745133d083 (patch)
tree4637509156e35ac172937d02e9639b6cde8b29a6 /app/models/cdr.rb
parent08ecc91d89a2b6a83daee4a1ffda5520e38e53c6 (diff)
cdrs added
Diffstat (limited to 'app/models/cdr.rb')
-rw-r--r--app/models/cdr.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/models/cdr.rb b/app/models/cdr.rb
new file mode 100644
index 0000000..ff9198f
--- /dev/null
+++ b/app/models/cdr.rb
@@ -0,0 +1,17 @@
+class Cdr < ActiveRecord::Base
+ self.table_name = 'cdrs'
+ self.primary_key = 'uuid'
+
+ belongs_to :account
+ belongs_to :bleg_account
+ belongs_to :forwarding_account
+
+
+ def self.seconds_to_minutes_seconds(call_seconds)
+ if call_seconds.to_i > 0
+ minutes = (call_seconds / 1.minutes).to_i
+ seconds = call_seconds - minutes.minutes.seconds
+ return '%i:%02i' % [minutes, seconds]
+ end
+ end
+end