Sha256: c6aa95a071299bc6da0b3dcb1bae791c84a9a1983da1b9fa3883069e7adf5c61
Contents?: true
Size: 709 Bytes
Versions: 6
Compression:
Stored size: 709 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_component def same_component return unless order && project errors.add(:order, :invalid) unless order.component == project.component end end end end
Version data entries
6 entries across 6 versions & 1 rubygems