Save pages to generate page_parts when a layout is updated

This commit is contained in:
chris 2012-12-03 17:25:27 +08:00
parent 036d7bbb0e
commit 6543491a53
1 changed files with 5 additions and 0 deletions

View File

@ -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