Class: Pulitzer::DestroyPostTypeContentElements
- Inherits:
-
Object
- Object
- Pulitzer::DestroyPostTypeContentElements
- Defined in:
- app/interactions/pulitzer/destroy_post_type_content_elements.rb
Instance Attribute Summary collapse
-
#post_type ⇒ Object
Returns the value of attribute post_type.
-
#ptcet ⇒ Object
Returns the value of attribute ptcet.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(ptcet) ⇒ DestroyPostTypeContentElements
constructor
A new instance of DestroyPostTypeContentElements.
Constructor Details
#initialize(ptcet) ⇒ DestroyPostTypeContentElements
Returns a new instance of DestroyPostTypeContentElements.
4 5 6 7 |
# File 'app/interactions/pulitzer/destroy_post_type_content_elements.rb', line 4 def initialize(ptcet) self.post_type = ptcet.post_type self.ptcet = ptcet end |
Instance Attribute Details
#post_type ⇒ Object
Returns the value of attribute post_type.
2 3 4 |
# File 'app/interactions/pulitzer/destroy_post_type_content_elements.rb', line 2 def post_type @post_type end |
#ptcet ⇒ Object
Returns the value of attribute ptcet.
2 3 4 |
# File 'app/interactions/pulitzer/destroy_post_type_content_elements.rb', line 2 def ptcet @ptcet end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 |
# File 'app/interactions/pulitzer/destroy_post_type_content_elements.rb', line 9 def call post_type.posts.each do |post| post.preview_version.content_elements.where(label: ptcet.label).each do |ce| ce.destroy end end end |