diff --git a/app/models/budget/investment/milestone.rb b/app/models/budget/investment/milestone.rb index 3f8ba4f3a..b00744138 100644 --- a/app/models/budget/investment/milestone.rb +++ b/app/models/budget/investment/milestone.rb @@ -11,11 +11,12 @@ class Budget globalize_accessors locales: [:en, :es, :fr, :nl, :val, :pt_br] belongs_to :investment + belongs_to :status, class_name: 'Budget::Investment::Status' validates :title, presence: true - validates :description, presence: true validates :investment, presence: true validates :publication_date, presence: true + validate :description_or_status_present? scope :order_by_publication_date, -> { order(publication_date: :asc) } @@ -23,6 +24,11 @@ class Budget 80 end + def description_or_status_present? + unless description.present? || status_id.present? + errors.add(:description) + end + end end end end