I’m trying to set up a simple application for running multiple blogs and my app/views/layouts/application.html.haml file looks like this:
!!!
%html
%head
%title Brimble's Blogs
= stylesheet_link_tag "application", :media => "all"
= javascript_include_tag "application"
= csrf_meta_tags
%body
%p.notice= notice
%p.alert= alert
.user-auth-nav{style => 'float:right'}
= if user_signed_in?
= link_to('Edit registration', edit_user_registration_path)
= link_to('Logout', destroy_user_session_path)
= else
= link_to('Login', new_user_session_path)
= link_to('Register', new_user_registration_path)
= end
= yield
The error I get is:
compile error
<myapp>/app/views/layouts/application.html.haml:18: syntax error, unexpected kELSE
<myapp>/app/views/layouts/application.html.haml:22: syntax error, unexpected kEND
<myapp>/app/views/layouts/application.html.haml:23: unknown regexp options - htl
<myapp>/app/views/layouts/application.html.haml:23: syntax error, unexpected $undefined
));}\n </div>\n</html>\n#{_hamlout.adjust_tabs(-2); _...
^
<myapp>/app/views/layouts/application.html.haml:25: syntax error, unexpected kENSURE, expecting $end
Extracted source (around line #18):
15: = link_to('Edit registration', edit_user_registration_path)
16: = link_to('Logout', destroy_user_session_path)
17: = else
18: = link_to('Login', new_user_session_path)
19: = link_to('Register', new_user_registration_path)
20: = end
21:
I’m following a tutorial on this page:
http://www.logansbailey.com/2011/02/27/adding-authorization-using-devise/
The tutorial uses erb but I really like the idea of Haml so I want to give it a go.
Thanks in advance
for ruby code that is not supposed to output something use
-instead of=:the
endtag can be omitted in haml.