Class: Decidim::Initiatives::CurrentInitiative
- Inherits:
-
Object
- Object
- Decidim::Initiatives::CurrentInitiative
- Includes:
- InitiativeSlug
- Defined in:
- app/constraints/decidim/initiatives/current_initiative.rb
Overview
This class infers the current initiative we are scoped to by looking at the request parameters and the organization in the request environment, and injects it into the environment.
Instance Method Summary collapse
-
#matches?(request) ⇒ Boolean
Public: Matches the request against an initiative and injects it into the environment.
Methods included from InitiativeSlug
Instance Method Details
#matches?(request) ⇒ Boolean
Public: Matches the request against an initiative and injects it
into the environment.
request - The request that holds the initiative relevant
information.
Returns a true if the request matched, false otherwise
18 19 20 21 22 23 24 25 |
# File 'app/constraints/decidim/initiatives/current_initiative.rb', line 18 def matches?(request) env = request.env @organization = env["decidim.current_organization"] return false unless @organization current_initiative(env, request.params) ? true : false end |