app/observers/inquiry_sweeper.rb in spud_inquiries-0.9.0 vs app/observers/inquiry_sweeper.rb in spud_inquiries-0.9.1
- old
+ new
@@ -26,15 +26,18 @@
private
def reset_cms_pages(record)
if defined? Spud::Cms::Engine #Is CMS Being Used?
values = [record.name]
values << @old_name if !@old_name.blank?
- SpudPageLiquidTag.where(:tag_name => "inquiry",:value => values).includes(:spud_page_partial).each do |tag|
- partial = tag.spud_page_partial
+ SpudPageLiquidTag.where(:tag_name => "inquiry",:value => values).includes(:attachment).each do |tag|
+ partial = tag.attachment
partial.postprocess_content
partial.save
- partial.spud_page.updated_at = Time.now.utc
- partial.spud_page.save
+ page = partial.try(:spud_page)
+ if page.blank? == false
+ page.updated_at = Time.now.utc
+ page.save
+ end
end
end
end