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 embeds_many :layout_parts
before_save :parse_layout before_save :parse_layout
after_save :save_pages
def content def content
self.file.read.force_encoding("UTF-8") rescue '' self.file.read.force_encoding("UTF-8") rescue ''
@ -25,4 +26,8 @@ class Layout < DesignFile
parse_body(self) parse_body(self)
end end
def save_pages
self.design.pages.each(&:save)
end
end end