Class: Pulitzer::CreatePostContentElements
- Inherits:
-
Object
- Object
- Pulitzer::CreatePostContentElements
- Defined in:
- app/interactions/pulitzer/create_post_content_elements.rb
Instance Attribute Summary collapse
-
#post ⇒ Object
Returns the value of attribute post.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(post) ⇒ CreatePostContentElements
constructor
A new instance of CreatePostContentElements.
Constructor Details
#initialize(post) ⇒ CreatePostContentElements
Returns a new instance of CreatePostContentElements.
4 5 6 |
# File 'app/interactions/pulitzer/create_post_content_elements.rb', line 4 def initialize(post) self.post = post end |
Instance Attribute Details
#post ⇒ Object
Returns the value of attribute post.
2 3 4 |
# File 'app/interactions/pulitzer/create_post_content_elements.rb', line 2 def post @post end |
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/interactions/pulitzer/create_post_content_elements.rb', line 8 def call post.post_type_content_element_types.each do |cet| post.preview_version.content_elements.create do |ce| ce.label = cet.label ce.height = cet.height ce.width = cet.width ce.text_editor = cet.text_editor ce.content_element_type = cet.content_element_type ce.post_type_content_element_type = cet end end post.free_form_section_types.each do |ffst| post.preview_version.free_form_sections.create name: ffst.name, free_form_section_type_id: ffst.id end end |