Pack up functionality done
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
class Gang < ApplicationRecord
|
||||
has_many :homies
|
||||
end
|
||||
has_many :homies, class_name: "Homie"
|
||||
has_many :money_moves, through: :homies
|
||||
has_many :works, through: :homies
|
||||
end
|
||||
|
||||
@@ -25,6 +25,17 @@ class MoneyMove < ApplicationRecord
|
||||
settle_record.save
|
||||
end
|
||||
|
||||
def to_csv_row
|
||||
[homie.name,
|
||||
amount,
|
||||
0,
|
||||
description,
|
||||
created_at.strftime("%Y-%m-%d"),
|
||||
deleted_at.present?.to_s].map do |element|
|
||||
element.to_s
|
||||
end
|
||||
end
|
||||
|
||||
class << self
|
||||
private
|
||||
|
||||
@@ -65,5 +76,6 @@ class MoneyMove < ApplicationRecord
|
||||
description: new_desc
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
class Work < ApplicationRecord
|
||||
belongs_to :homie
|
||||
end
|
||||
|
||||
def to_csv_row
|
||||
[homie.name,
|
||||
0,
|
||||
amount,
|
||||
description,
|
||||
created_at.strftime("%Y-%m-%d"),
|
||||
false].map do |element|
|
||||
element.to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user