lib/codily/elements/base.rb in codily-0.3.0 vs lib/codily/elements/base.rb in codily-0.3.1

- old
+ new

@@ -151,10 +151,12 @@ def refer_element(klass, obj, key2, &block) list = root.list_element(klass) element = klass.new(root, obj, &block) element_query = element.__send__(key2) - candidate = list.each_value.find { |_| _.__send__(key2) == element_query } + candidate = list.each_value.find { |_| + element_query == _.__send__(key2) && element.key == _.key + } if candidate if block raise AlreadyDefined end else