#806 ✓resolved
Tomoaki Hayasaka

``<table>`` raises "no block given (yield)"

Reported by Tomoaki Hayasaka | September 27th, 2010 @ 04:40 PM | in Hobo 1.3 (Rails 3)

I use Hobo 1.3pre6 + Rails 3.0.

When <table> is called, "no block given (yield)" is raised.

Here's a hack, which depends on ActionView internals.

diff --git a/dryml/lib/dryml/template_environment.rb b/dryml/lib/dryml/template_environment.rb
index 1fe21a7..2d84c3f 100644
--- a/dryml/lib/dryml/template_environment.rb
+++ b/dryml/lib/dryml/template_environment.rb
@@ -575,11 +575,16 @@ module Dryml
       end
       # TEST IT: does that work in rails 3?
       # changed because block_called_from_erb? has been removed
-      content = capture(new_context { yield }) if block_given?
-      if empty
-        "<#{name}#{attr_string}#{scope.xmldoctype ? ' /' : ''}>".html_safe
+      content = capture { new_context &block } if block_given?
+      res = if empty
+              "<#{name}#{attr_string}#{scope.xmldoctype ? ' /' : ''}>".html_safe
+            else
+              "<#{name}#{attr_string}>".html_safe + content + "</#{name}>".html_safe
+            end
+      if content.is_a? ActionView::NonConcattingString
+        concat res
       else
-        "<#{name}#{attr_string}>".html_safe + content + "</#{name}>".html_safe
+        res
       end
     end

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Tags

Pages