From c5e130b5c367defe7af545b7f7a15193700af2b4 Mon Sep 17 00:00:00 2001 From: Stas Date: Fri, 18 Mar 2016 15:41:40 +0200 Subject: [PATCH] 115336093-added_registrar_code --- app/models/account_activity.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/account_activity.rb b/app/models/account_activity.rb index 84a9f9137..3a0e7dc30 100644 --- a/app/models/account_activity.rb +++ b/app/models/account_activity.rb @@ -6,6 +6,8 @@ class AccountActivity < ActiveRecord::Base belongs_to :bank_transaction belongs_to :invoice + attr_accessor :registrar + CREATE = 'create' RENEW = 'renew' ADD_CREDIT = 'add_credit' @@ -22,12 +24,13 @@ class AccountActivity < ActiveRecord::Base end def to_csv - attributes = %w(description activity_type created_at sum) + attributes = %w(registrar description activity_type created_at sum) CSV.generate(headers: true) do |csv| - csv << %w(description activity_type receipt_date sum) + csv << %w(registrar description activity_type receipt_date sum) all.each do |x| # rubocop:disable Rails/FindEach + x.registrar = Registrar.find(x.account_id).try(:code) csv << attributes.map { |attr| x.send(attr) } end end