Class: Decidim::Pages::DestroyPage

Inherits:
Rectify::Command
  • Object
show all
Defined in:
app/commands/decidim/pages/destroy_page.rb

Overview

Command that gets called when the page of this component needs to be destroyed. It usually happens as a callback when the component is removed.

Instance Method Summary collapse

Constructor Details

#initialize(component) ⇒ DestroyPage

Returns a new instance of DestroyPage.



8
9
10
# File 'app/commands/decidim/pages/destroy_page.rb', line 8

def initialize(component)
  @component = component
end

Instance Method Details

#callObject



12
13
14
15
# File 'app/commands/decidim/pages/destroy_page.rb', line 12

def call
  Page.where(component: @component).destroy_all
  broadcast(:ok)
end