Class: Pulitzer::UpdatePostTypeFreeFormSections
- Inherits:
-
Object
- Object
- Pulitzer::UpdatePostTypeFreeFormSections
- Defined in:
- app/interactions/pulitzer/update_post_type_free_form_sections.rb
Instance Attribute Summary collapse
-
#ffst ⇒ Object
Returns the value of attribute ffst.
-
#old_label ⇒ Object
Returns the value of attribute old_label.
-
#post_type ⇒ Object
Returns the value of attribute post_type.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(ffst, old_label = nil) ⇒ UpdatePostTypeFreeFormSections
constructor
A new instance of UpdatePostTypeFreeFormSections.
Constructor Details
#initialize(ffst, old_label = nil) ⇒ UpdatePostTypeFreeFormSections
Returns a new instance of UpdatePostTypeFreeFormSections.
4 5 6 7 8 |
# File 'app/interactions/pulitzer/update_post_type_free_form_sections.rb', line 4 def initialize(ffst, old_label=nil) self.post_type = ffst.post_type self.ffst = ffst self.old_label = old_label || ffst.label end |
Instance Attribute Details
#ffst ⇒ Object
Returns the value of attribute ffst.
2 3 4 |
# File 'app/interactions/pulitzer/update_post_type_free_form_sections.rb', line 2 def ffst @ffst end |
#old_label ⇒ Object
Returns the value of attribute old_label.
2 3 4 |
# File 'app/interactions/pulitzer/update_post_type_free_form_sections.rb', line 2 def old_label @old_label end |
#post_type ⇒ Object
Returns the value of attribute post_type.
2 3 4 |
# File 'app/interactions/pulitzer/update_post_type_free_form_sections.rb', line 2 def post_type @post_type end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/interactions/pulitzer/update_post_type_free_form_sections.rb', line 10 def call post_type.posts.each do |post| post.preview_version.free_form_sections.where(free_form_section_type_id: ffst.id).each do |ffs| ffs.update(name: ffst.name) end end end |