Add community to investments

This commit is contained in:
taitus
2017-08-23 20:51:16 +02:00
parent 4539c5fa00
commit 895c942a39
11 changed files with 65 additions and 11 deletions

View File

@@ -21,6 +21,7 @@ class Budget
belongs_to :group
belongs_to :budget
belongs_to :administrator
belongs_to :community
has_many :valuator_assignments, dependent: :destroy
has_many :valuators, through: :valuator_assignments
@@ -71,6 +72,7 @@ class Budget
before_save :calculate_confidence_score
after_save :recalculate_heading_winners if :incompatible_changed?
before_create :associate_community
before_validation :set_responsible_name
before_validation :set_denormalized_ids
@@ -258,6 +260,11 @@ class Budget
investments
end
def associate_community
community = Community.create
self.community_id = community.id
end
private
def set_denormalized_ids