Class: Decidim::Pages::DestroyPage
- 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
- #call ⇒ Object
-
#initialize(component) ⇒ DestroyPage
constructor
A new instance of DestroyPage.
Methods inherited from Command
call, #evaluate, #method_missing, #respond_to_missing?, #transaction, #with_events
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 |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Decidim::Command
Instance Method Details
#call ⇒ Object
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 |