add homie to the gang when homie is created

This commit is contained in:
Bilal
2020-10-07 22:47:19 +03:00
parent 8d7716f2e0
commit 8832ba071b
9 changed files with 43 additions and 5 deletions

View File

@@ -1,3 +1,3 @@
class Gang < ApplicationRecord
has_many :homies
end

View File

@@ -2,6 +2,8 @@ class Homie < ApplicationRecord
has_many :money_moves
has_many :work
belongs_to :gang
def self.info(importance)
cash_totals = Homie.all.joins(:money_moves).group(:id).order(:id).sum(:amount)
work_totals = Homie.all.joins(:work).group(:id).order(:id).sum(:amount)