Class: Decidim::Pages::DestroyPage

Inherits:
Command
  • Object
show all
Defined in:
decidim-pages/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 'decidim-pages/app/commands/decidim/pages/destroy_page.rb', line 8

def initialize(component)
  @component = component
end

Instance Method Details

#callObject


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

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