Class: Decidim::Elections::CensusChecksController
- Inherits:
-
ApplicationController
- Object
- Components::BaseController
- ApplicationController
- Decidim::Elections::CensusChecksController
- Includes:
- UsesCensusAccess
- Defined in:
- app/controllers/decidim/elections/census_checks_controller.rb
Overview
Allows participants to verify they belong to an election census before voting starts.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/decidim/elections/census_checks_controller.rb', line 21 def create (:create, :census_check, election:) @form = election.census.form_instance(params, election:, current_user:) if @form.valid? session[:session_attributes] = @form.attributes redirect_to election_census_check_path(election) else flash[:alert] = @form.errors..join("<br>").presence || t("failed", scope: "decidim.elections.votes.check_census") redirect_to new_election_census_check_path(election) end end |
#new ⇒ Object
14 15 16 17 18 19 |
# File 'app/controllers/decidim/elections/census_checks_controller.rb', line 14 def new (:create, :census_check, election:) @form = election.census.form_instance({}, election:, current_user:) render "decidim/elections/votes/new" end |
#show ⇒ Object
34 35 36 |
# File 'app/controllers/decidim/elections/census_checks_controller.rb', line 34 def show (:read, :census_check, election:) end |