Thanks Nathan. I tried to get the updated code but the haml svn
server
appears to be down again. I'm sure it'll work great though when the
svn
comes back up. thanks :P
-Robin
On May 15, 11:52 am, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> So, did you know that yield(*args) and block.call(*args) actually do
> different things? They do. It's weird. That's what was causing the odd
> behavior that made me take out that splat in the first place. But now
> it's all good in trunk.
>
> - Nathan
>
> Robin wrote:
> > I noticed that the latest svn release of Haml broke my project. On
> > further inspection I noticed that it was due to a helper I had to
> > iterate through a collection and build table rows that looks something
> > like this:
>
> > def trc(collection = nil, &block)
> > collection.each do |record|
> > content = capture(record, &block)
> > concat(tag(:tr, {:class => cycle('even', 'odd')}, true),
> > block.binding)
> > concat(content, block.binding)
> > concat("</tr>", block.binding)
> > end
> > end
>
> > I call the above helper like this:
>
> > - trc @users do |user|
> > %td= user[:name]
>
> > When running the above code on the results from an ActiveRecord query,
> > it was passing the ActiveRecord row in an array to my block instead of
> > the object itself. After investigating, I believe that "yield args"
> > in lib/haml/helpers.rb (around line 293) should be yield *args. I've
> > submitted a patch for this, and a test to show that it works.
>
> > HOWEVER, this patch seems to break another test,
> > test_list_of_should_render_correctly, which is suspicious. The part
> > of the test that fails is this:
>
> > assert_equal("<li>1</li>\n", render("= list_of([[1]]) do |i|\n =
> > i.first"))
>
> > The reason it fails is that it tries to call .first on the FixNum
> > instead of on [1], which sounds like I've mucked it up somehow.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---