app/models/decidim/budgets/line_item.rb in decidim-budgets-0.2.0 vs app/models/decidim/budgets/line_item.rb in decidim-budgets-0.3.0
- old
+ new
@@ -6,11 +6,10 @@
# association between an order and a project.
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, presence: true, uniqueness: { scope: :project }
- validates :project, presence: true
+ validates :order, uniqueness: { scope: :project }
validate :same_feature
def same_feature
return unless order && project
errors.add(:order, :invalid) unless order.feature == project.feature