On Dec 11, 8:08 am, Nathan Weizenbaum <[EMAIL PROTECTED]> wrote:
> What version are you using? In Haml 1.7.2, both empty and nil values
> result in a non-rendering attribute. I agree that empty values should
> render as empty attributes - this is the behavior in trunk.

1.7.2. I got the exception when I upgraded. This produces the
exception:

Haml::Engine.new(".a{ :id => '', :class => 'c'}").render

How about:

result = attributes.reject{|a,v| v.nil? }.collect do |a,v|

... and delete the unless condition?

>
> I only use empty? on variables I know to be strings or arrays, for which
> it's defined in core.

Right, I missed the to_s conversion.

Cheers,

Michiel.

>
> - Nathan
>
> Michiel de Mare wrote:
> > Oh, another thing - don't use "empty?" because it's defined for very
> > few objects outside rails.
>
> > On Dec 11, 7:44 am, Michiel de Mare <[EMAIL PROTECTED]> wrote:
>
> >> Attributes with nil or empty values cause an exception (in
> >> Haml::Engine#build_attributes at line 685, sorting an array with
> >> nils).
>
> >> Also, I think the intention of the code is to skip attributes with
> >> empty values, but that's definitely not desired - empty attribute
> >> values are often necessary.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to