lib/ruhl.rb in ruhl-0.9.2 vs lib/ruhl.rb in ruhl-0.9.3
- old
+ new
@@ -64,13 +64,14 @@
tag['data-ruhl'] = actions if actions.length > 0
html = tag.to_html
new_content = results.collect do |item|
- if actions.length == 0 && tag.children.length == 0
- t = tag.dup
- t.inner_html = item.to_s
- t
+ # Call to_s on the item only if there are no other actions
+ # and there are no other nested data-ruhls
+ if actions.length == 0 && tag.xpath('.//*[@data-ruhl]').length == 0
+ tag.inner_html = item.to_s
+ tag.to_html
else
Ruhl::Engine.new(html, :local_object => item).render(scope)
end
end.to_s