Sha256: 88649b0145d3f028760977a4d0dfb15ceee33fa5e1c1e6231bcceec0df5339aa

Contents?: true

Size: 1.28 KB

Versions: 13

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module Decidim
  module Budgets
    # The data store for a budget in the Decidim::Budgets component.
    class Budget < ApplicationRecord
      include Decidim::Resourceable
      include Decidim::ScopableResource
      include Decidim::HasComponent
      include Decidim::Searchable
      include Decidim::Randomable
      include Traceable
      include Loggable

      component_manifest_name "budgets"

      has_many :projects, foreign_key: "decidim_budgets_budget_id", class_name: "Decidim::Budgets::Project", inverse_of: :budget, dependent: :destroy
      has_many :orders, foreign_key: "decidim_budgets_budget_id", class_name: "Decidim::Budgets::Order", inverse_of: :budget, dependent: :destroy

      delegate :participatory_space, :manifest, :settings, to: :component

      searchable_fields({
                          participatory_space: { component: :participatory_space },
                          A: :title,
                          D: [:description, :total_budget]
                        },
                        index_on_create: ->(budget) { budget.visible? },
                        index_on_update: ->(budget) { budget.visible? })

      def self.log_presenter_class_for(_log)
        Decidim::Budgets::AdminLog::BudgetPresenter
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-budgets-0.29.1 app/models/decidim/budgets/budget.rb
decidim-budgets-0.28.4 app/models/decidim/budgets/budget.rb
decidim-budgets-0.29.0 app/models/decidim/budgets/budget.rb
decidim-budgets-0.28.3 app/models/decidim/budgets/budget.rb
decidim-budgets-0.29.0.rc4 app/models/decidim/budgets/budget.rb
decidim-budgets-0.29.0.rc3 app/models/decidim/budgets/budget.rb
decidim-budgets-0.29.0.rc2 app/models/decidim/budgets/budget.rb
decidim-budgets-0.29.0.rc1 app/models/decidim/budgets/budget.rb
decidim-budgets-0.28.2 app/models/decidim/budgets/budget.rb
decidim-budgets-0.28.1 app/models/decidim/budgets/budget.rb
decidim-budgets-0.28.0 app/models/decidim/budgets/budget.rb
decidim-budgets-0.28.0.rc5 app/models/decidim/budgets/budget.rb
decidim-budgets-0.28.0.rc4 app/models/decidim/budgets/budget.rb