Class: Decidim::Pages::CreatePage
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::Pages::CreatePage
- Defined in:
- app/commands/decidim/pages/create_page.rb
Overview
Command that gets called whenever a feature’s page has to be created. It usually happens as a callback when the feature itself is created.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(feature) ⇒ CreatePage
constructor
A new instance of CreatePage.
Constructor Details
#initialize(feature) ⇒ CreatePage
Returns a new instance of CreatePage.
7 8 9 |
# File 'app/commands/decidim/pages/create_page.rb', line 7 def initialize(feature) @feature = feature end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 |
# File 'app/commands/decidim/pages/create_page.rb', line 11 def call @page = Page.new(feature: @feature) @page.save ? broadcast(:ok) : broadcast(:invalid) end |