diff options
Diffstat (limited to 'app/models/cdr.rb')
-rw-r--r-- | app/models/cdr.rb | 17 |
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 |