app/controllers/concerns/decidim/votings/needs_voting.rb in decidim-elections-0.24.3 vs app/controllers/concerns/decidim/votings/needs_voting.rb in decidim-elections-0.25.0.rc1

- old
+ new

@@ -5,11 +5,11 @@ # This module, when injected into a controller, ensures there's a # voting available and deducts it from the context. module NeedsVoting def self.enhance_controller(instance_or_module) instance_or_module.class_eval do - helper_method :current_voting + helper_method :current_participatory_space end end def self.included(base) base.include Decidim::NeedsOrganization, InstanceMethods @@ -20,19 +20,19 @@ module InstanceMethods # Public: Finds the current Voting given this controller's # context. # # Returns the current Voting. - def current_voting - @current_voting ||= detect_voting + def current_participatory_space + @current_participatory_space ||= detect_voting end - alias current_participatory_space current_voting + alias current_voting current_participatory_space private def detect_voting - request.env["current_voting"] || + request.env["current_participatory_space"] || organization_votings.find_by(slug: params[:voting_slug] || params[:slug]) end def organization_votings @organization_votings ||= OrganizationVotings.new(current_organization).query