Do not create layout part if it already exists

This commit is contained in:
chris 2012-12-03 18:59:32 +08:00
parent 4f9aa63045
commit fbe2b26e9f
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@ module ParserLayout
body = Nokogiri::HTML(layout.body)
body.css('.page_content').each do |content|
layout.layout_parts.build(:name => content['name'])
layout.layout_parts.build(:name => content['name']) unless layout.layout_parts.detect{|layout_part| layout_part.name.eql?(content['name'])}
end
body.css('.page_menu').each do |menu|