From fbe2b26e9f94ac39a8f7306898bbe66cd3856aa3 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 3 Dec 2012 18:59:32 +0800 Subject: [PATCH] Do not create layout part if it already exists --- lib/parsers/parser_layout.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/parsers/parser_layout.rb b/lib/parsers/parser_layout.rb index 817bf327..d3f6fb72 100644 --- a/lib/parsers/parser_layout.rb +++ b/lib/parsers/parser_layout.rb @@ -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|