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 feature needs to be destroyed. It usually happens as a callback when the feature is removed.

Instance Method Summary collapse

Constructor Details

#initialize(feature) ⇒ DestroyPage

Returns a new instance of DestroyPage.



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

def initialize(feature)
  @feature = feature
end

Instance Method Details

#callObject



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

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