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

Inherits:
Command
  • Object
show all
Defined in:
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

Constructor Details

#initialize(ballot_style, current_user) ⇒ DestroyBallotStyle

Returns a new instance of DestroyBallotStyle.



8
9
10
11
# File '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

Instance Method Details

#callObject

Executes the command. Broadcast this events:

  • :ok when everything is valid

  • :invalid when the form wasn’t valid and couldn’t proceed

Returns nothing.



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

def call
  destroy_ballot_style!

  broadcast(:ok)
end