Nathan, did you get a chance to look at this failing test?
-Stephen
On Nov 30, 12:16 pm, sdsykes <[EMAIL PROTECTED]> wrote:
> Yes.
>
> This is the kind of thing we are doing in our app - try adding this to
> helper_test.rb
>
> class ActionView::Base
> module Ahelper
> def nested_tag
> content_tag(:span) {content_tag(:div) {"something"}}
> end
> end
> include Ahelper
> end
>
> def test_content_tag_nested
> assert_equal "<span><div>something</div></span>", render("=
> nested_tag", :action_view).strip
> end
>
> And this test is fixed by at least by adding '&& block_is_haml?
> (block)' to line 89 in action_view_mods.rb, but perhaps you can look
> at it in more depth than I have.
>
> -Stephen
>
> On Nov 29, 9:21 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
>
>
>
> > Can you supply a failing test?
>
> > sdsykes wrote:
> > > The problem remains in 2.0.5
>
> > > This version I can fix just by changing line 89 of action_view_mods.rb
> > > from
>
> > > if is_haml?
>
> > > to
>
> > > if is_haml && block_is_haml?(block)
>
> > > -Stephen
>
> > > On Nov 29, 1:44 am, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
>
> > >> This has been fixed in the latest stable. It'll be released as part of
> > >> 2.0.5 soon.
>
> > >> sdsykes wrote:
>
> > >>> Yes, this is a very serious bug - it nixes your content tags in rails
> > >>> 2.2.
>
> > >>> Before I saw this post I came up with my own fix, but in
> > >>> capture_with_haml and not in content_tag_with_haml.
>
> > >>> This fix is shorter - I just changed line 96 of action_view_mods.rb
> > >>> from this:
>
> > >>> if is_haml?
>
> > >>> to this:
>
> > >>> block_is_haml =
> > >>> begin
> > >>> eval('_hamlout', block)
> > >>> true
> > >>> rescue
> > >>> false
> > >>> end
>
> > >>> if block_is_haml && is_haml?
>
> > >>> - Stephen
>
> > >>> On Nov 23, 7:00 am, railsjedi <[EMAIL PROTECTED]> wrote:
>
> > >>>> Ok, I tracked all my frustrations with haml helpers down to an
> > >>>> incompatibility in content_tag between Rails 2.2 and Haml 2.0.5
>
> > >>>> When I try rendering this call in my haml view, nothing shows up:
>
> > >>>> - content_tag :div do
> > >>>> SHOW ME SOME CONTENT
>
> > >>>> I tried this both on Haml 2.0.4 and the latest Haml Edge (0a14c3) both
> > >>>> install via plugins. In all cases the content doesnt display.
>
> > >>>> Here is a test project that demonstrates the problem. Use it with Haml
> > >>>> 2.0.4 and Rails 2.2 and you'll see the content doesnt display in Haml.
> > >>>> On Rails 2.1 however, it will work fine.
>
> > >>>>http://s3.amazonaws.com/railsjedi/hamlbug_rails22.zip
>
> > >>>> Traced the problem down to the content_tag alias method chaining in
> > >>>> lib/haml/helpers/action_view_mods.rb
>
> > >>>> I've added a unit test that isolates the bug as well as a fix for the
> > >>>> issue in Rails 2.2. If you are running into this error when using Haml
> > >>>> with Rails 2.2, give it a try. It should resolve your
> > >>>> problems.http://github.com/jcnetdev/haml/commit/bc27e25fcafedb85ce37d818d28721...
>
> > >>>> Hope this helps. Be great to get a patch for this into 2.0.5 soon
> > >>>> before more Rails 2.2 users run into this issue.
>
> > >>>> On Nov 19, 11:19 pm, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
>
> > >>>>> All the ERB helpers should work with Haml - if they don't, that's a
> > >>>>> bug.
> > >>>>> The Haml helpers do require Haml, so you should avoid using them in a
> > >>>>> mixed environment. The reason things like haml_concat and capture_haml
> > >>>>> exist is to provide something for non-Rails environments.
>
> > >>>>> railsjedi wrote:
>
> > >>>>>> Hi. I'm trying to write some view helpers that take blocks. Running
> > >>>>>> into the issue that some views are HAML and some are ERB. So erb
> > >>>>>> seems
> > >>>>>> to break haml_tag, and haml seems to break content_tag. Also concat
> > >>>>>> vs
> > >>>>>> haml_concat, and capture vs capture_haml. All very confusing. Seems
> > >>>>>> like helpers should be halpers, and work in all contexts no matter
> > >>>>>> the
> > >>>>>> view layer.
>
> > >>>>>> Is there an easy way to convert from one to the other? Maybe by just
> > >>>>>> wrapping it in a capture block or something?
>
> > >>>>>> Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---