Class: Decidim::Votings::Admin::DestroyBallotStyle

Inherits:
Command
  • Object
show all
Defined in:
decidim-elections/app/commands/decidim/votings/admin/destroy_ballot_style.rb

Overview

A command with the business logic to delete the ballot style

Instance Method Summary collapse

Methods inherited from Command

call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events

Constructor Details

#initialize(ballot_style, current_user) ⇒ DestroyBallotStyle

Returns a new instance of DestroyBallotStyle.



8
9
10
11
# File 'decidim-elections/app/commands/decidim/votings/admin/destroy_ballot_style.rb', line 8

def initialize(ballot_style, current_user)
  @ballot_style = ballot_style
  @current_user = current_user
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Decidim::Command

Instance Method Details

#callObject

Executes the command. Broadcast this events:

  • :ok when everything is valid

  • :invalid when the form was not valid and could not proceed

Returns nothing.



18
19
20
21
22
# File 'decidim-elections/app/commands/decidim/votings/admin/destroy_ballot_style.rb', line 18

def call
  destroy_ballot_style!

  broadcast(:ok)
end