Class: Decidim::Pages::DestroyPage
- Inherits:
-
Command
- Object
- Command
- Decidim::Pages::DestroyPage
- 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
- #call ⇒ Object
-
#initialize(component) ⇒ DestroyPage
constructor
A new instance of DestroyPage.
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
#call ⇒ Object
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 |