Sha256: b789d13d93f43a1083ff911e92cdd27b3645a5cb2f787794c8f09d00eb358bad
Contents?: true
Size: 700 Bytes
Versions: 54
Compression:
Stored size: 700 Bytes
Contents
# frozen_string_literal: true module Decidim module Budgets # The data store for a LineItem in the Decidim::Budgets component. It describes an # 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, uniqueness: { scope: :project } validate :same_feature def same_feature return unless order && project errors.add(:order, :invalid) unless order.feature == project.feature end end end end
Version data entries
54 entries across 54 versions & 2 rubygems