Sha256: 80e481175eadf11a0fbff55356d930b6d87affe2cf8e985f07aa9b9c6a48a096

Contents?: true

Size: 647 Bytes

Versions: 29

Compression:

Stored size: 647 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  module Budgets
    # Shared behaviour for controllers that need the current order to be present.
    module NeedsCurrentOrder
      extend ActiveSupport::Concern

      included do
        helper_method :current_order

        # The current order created by the user.
        #
        # Returns an Order.
        def current_order
          @current_order ||= Order.includes(:projects).find_by(user: current_user, component: current_component)
        end

        def current_order=(order)
          @current_order = order
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
decidim-budgets-0.21.0 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.20.1 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.20.0 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.19.1 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.18.1 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.19.0 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.17.2 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.18.0 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.17.1 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.16.1 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.17.0 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.16.0 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.15.2 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.15.1 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.15.0 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.14.4 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.14.3 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.14.2 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.14.1 app/controllers/concerns/decidim/budgets/needs_current_order.rb
decidim-budgets-0.13.1 app/controllers/concerns/decidim/budgets/needs_current_order.rb