``<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
-
Domizio Demichelis September 29th, 2010 @ 06:28 PM
- State changed from new to open
- Milestone set to Hobo 1.3 (Rails 3)
- Assigned user set to Domizio Demichelis
- Milestone order changed from 197897 to 0
Please, could you post an example so I will have a working test case in no time? :-)
-
Domizio Demichelis September 29th, 2010 @ 10:08 PM
- State changed from open to resolved
applied in d2d50f364
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »