I just created a new Rails 3 project and brought over some code from a
previous project.  Surprisingly (to me) some of it isn't compiling.

The problem line is:

Welcome Back#{", " unless current_user.name.blank?}

The error I get is:

...l/app/views/layouts/application.html.haml:30: syntax error,
unexpected modifier_unless, expecting ')'
...Helpers.html_escape(", " unless current_user.name.blank?)}"

If I change it to the below, it works fine.  But it's so ugly:

== Welcome Back#{if current_user.name; ", "; end}

I'm running haml version 3.0.18.  My old project was (admittedly) much
older - Rails 2 running haml 2.2.20.

Just to see if the syntax had changed I created a simple erb file that
had:

Welcome Back<%= "," unless current_user.name.blank? %>

And ran html2haml (version 3.0.18) on it.  It produced:

Welcome Back#{", " unless current_user.name.blank?}

Which threw the unexpected modifer_unless error.  Is this not supposed
to work now?  Should I just make a helper method and be done w/ it?

For the record I also tried haml version 3.0.13 and still got the
error.

Thanks, all.

Pat

-- 
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to h...@googlegroups.com.
To unsubscribe from this group, send email to haml+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/haml?hl=en.

Reply via email to