Deprecation Warning with link_to_unless and link_to_unless_current

50 views
Skip to first unread message

Rob Cameron

unread,
Jul 19, 2010, 8:00:59 PM7/19/10
to Haml
So when using either link_to_unless or link_to_unless_current:

- link_to_unless(controller.controller_name == 'home', 'Dashboard',
root_path) do
%span Dashboard

I get a deprecation warning about starting with a -

DEPRECATION WARNING: - style block helpers are deprecated. Please use
=. (called from
_render_template_2471452342752540530_2154256720__1773247589947495410
at /Users/rob/Sites/my_app/app/views/layouts/application.html.haml:37)

So, I switch to using an equals sign, however now I get the number 6
output after my span!

http://skitch.com/cannikin/dpeim/active-trainer-2-the-return
http://skitch.com/cannikin/dpeip/source-of-http-localhost-3000

Happens every time, no matter the length of the text in the block. If
I switch to :erb and then write the code, and do NOT use equals, I
don't get the deprecation warning and everything outputs okay:

:erb
<% link_to_unless(controller.controller_name == 'home', 'Dashboard',
root_path) do %>
<span>Dashboard</span>
<% end %>

If I use the = version I get an error!

/Users/rob/Sites/trainer2/app/views/layouts/application.html.haml:
35: syntax error, unexpected ')'
...), 'Dashboard', root_path) do ).to_s); _erbout.concat "\n ...
... ^
/Users/rob/Sites/trainer2/app/views/layouts/application.html.haml:
49: syntax error, unexpected keyword_end, expecting ')'
end;_hamlout.push_text(" #{_h...
^
/Users/rob/Sites/trainer2/app/views/layouts/application.html.haml:
65: syntax error, unexpected keyword_ensure, expecting ')'
...:Util.html_safe(_erbout);ensure;@haml_buffer = @haml_buffer....
... ^
/Users/rob/Sites/trainer2/app/views/layouts/application.html.haml:
65: syntax error, unexpected keyword_end, expecting ')'
...buffer = @haml_buffer.upper;end;
... ^
/Users/rob/Sites/trainer2/app/views/layouts/application.html.haml:
68: syntax error, unexpected keyword_end, expecting ')'


So, it is Rails3 freaking out, or HAML?

Thanks,
Rob

Nathan Weizenbaum

unread,
Jul 19, 2010, 8:13:04 PM7/19/10
to ha...@googlegroups.com
If link_to_unless is a Rails helper, then this is a Rails bug.


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


Rob Cameron

unread,
Jul 20, 2010, 12:12:07 PM7/20/10
to Haml
Yeah, link_to_unless and link_to_unless_current are in
ActionView::Helpers::UrlHelper.

Thanks! I'll open up a ticket on their Lighthouse.

Rob
> > haml+uns...@googlegroups.com <haml%2Bunsu...@googlegroups.com>.

Rob Cameron

unread,
Jul 20, 2010, 12:28:36 PM7/20/10
to Haml
Reply all
Reply to author
Forward
0 new messages