From 6543491a537464f35dfb9b66c142bdfe7e92fbfe Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 3 Dec 2012 17:25:27 +0800 Subject: [PATCH] Save pages to generate page_parts when a layout is updated --- app/models/design/layout.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/design/layout.rb b/app/models/design/layout.rb index a782894d..8755b099 100644 --- a/app/models/design/layout.rb +++ b/app/models/design/layout.rb @@ -10,6 +10,7 @@ class Layout < DesignFile embeds_many :layout_parts before_save :parse_layout + after_save :save_pages def content self.file.read.force_encoding("UTF-8") rescue '' @@ -24,5 +25,9 @@ class Layout < DesignFile self.body = html.at_css("body").inner_html parse_body(self) end + + def save_pages + self.design.pages.each(&:save) + end end