Sha256: 63651f63ee906778c1ecbaaa89ff7ac9f355db1afbaf5e5366a7ea34b547bba6

Contents?: true

Size: 638 Bytes

Versions: 45

Compression:

Stored size: 638 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Budgets
    # Exposes the budget resources so users can participate on them
    class BudgetsController < Decidim::Budgets::ApplicationController
      def index
        redirect_to budget_projects_path(current_workflow.single) if current_workflow.single?
      end

      def show
        raise ActionController::RoutingError, "Not Found" unless budget

        redirect_to budget_projects_path(budget)
      end

      private

      def budget
        @budget ||= Budget.where(component: current_component).includes(:projects).find_by(id: params[:id])
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 1 rubygems

Version Path
decidim-budgets-0.23.3 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.23.2 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.23.1 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.23.1.rc1 app/controllers/decidim/budgets/budgets_controller.rb
decidim-budgets-0.23.0 app/controllers/decidim/budgets/budgets_controller.rb