Class: Decidim::Pages::DataImporter
- Inherits:
-
Importers::Importer
- Object
- Importers::Importer
- Decidim::Pages::DataImporter
- Defined in:
- app/serializers/decidim/pages/data_importer.rb
Overview
Importer for Pages specific data (i.e. its page content).
Instance Method Summary collapse
-
#import(serialized, _user) ⇒ Decidim::Pages::Page
Creates a new Decidim::Pages::Page associated to the given component for the serialized page object.
-
#initialize(component) ⇒ DataImporter
constructor
A new instance of DataImporter.
Constructor Details
#initialize(component) ⇒ DataImporter
Returns a new instance of DataImporter.
7 8 9 |
# File 'app/serializers/decidim/pages/data_importer.rb', line 7 def initialize(component) @component = component end |
Instance Method Details
#import(serialized, _user) ⇒ Decidim::Pages::Page
Creates a new Decidim::Pages::Page associated to the given component for the serialized page object.
17 18 19 20 21 22 23 24 |
# File 'app/serializers/decidim/pages/data_importer.rb', line 17 def import(serialized, _user) return unless serialized Page.create!( component: @component, body: serialized["body"] ) end |