Sha256: b146d660da4dfb0e2f08f728d602c83807ec0040f3ec80c8a686d8881554f628
Contents?: true
Size: 831 Bytes
Versions: 15
Compression:
Stored size: 831 Bytes
Contents
# frozen_string_literal: true require "active_support/concern" module Decidim # Shared behaviour for controllers that need an organization present in order # to work. The origanization is injected via the CurrentOrganization # middleware. module NeedsOrganization extend ActiveSupport::Concern included do before_action :verify_organization helper_method :current_organization # The current organization for the request. # # Returns an Organization. def current_organization @current_organization ||= request.env["decidim.current_organization"] end private # Raises a 404 if no organization is present. def verify_organization raise ActionController::RoutingError, "Not Found" unless current_organization end end end end
Version data entries
15 entries across 15 versions & 1 rubygems