app/models/decidim/budgets/line_item.rb in decidim-budgets-0.10.1 vs app/models/decidim/budgets/line_item.rb in decidim-budgets-0.11.0.pre1

- old
+ new

@@ -7,14 +7,14 @@ class LineItem < Budgets::ApplicationRecord belongs_to :order, class_name: "Decidim::Budgets::Order", foreign_key: "decidim_order_id" belongs_to :project, class_name: "Decidim::Budgets::Project", foreign_key: "decidim_project_id" validates :order, uniqueness: { scope: :project } - validate :same_feature + validate :same_component - def same_feature + def same_component return unless order && project - errors.add(:order, :invalid) unless order.feature == project.feature + errors.add(:order, :invalid) unless order.component == project.component end end end end