= tabs_tag(:open_tabs => { :id => "menu" }) do |tab|
- menu_tabs.each do |menu_tab|
- if !menu_tab.only_if.nil?
- if menu_tab.only_if.call
= tab.send menu_tab.tab_name, menu_tab.display_name, menu_tab.path, :span => "arrow-down"
- if !menu_tab.child_elements.blank?
%ul
- menu_tab.child_elements.each do |child_tab|
%li
=link_to child_tab.display_name, child_tab.path
- else
= tab.send menu_tab.tab_name, menu_tab.display_name, menu_tab.path
The error message is
app/views/menu_builder/_tab_view.html.haml:15: syntax error, unexpected keyword_else, expecting keyword_end
app/views/menu_builder/_tab_view.html.haml:21: syntax error, unexpected keyword_ensure, expecting $end
(btw the line numbers are wrong too, I don’t know if this is a haml thing)
I have checked the indentation and everything should be correct, and that else should correspond to if !menu_tab.only_if.nil?, so I don’t understand why this error message is appearing.
I’m guessing it’s because you’re doing this:
and
and then nesting content under that which is illegal in HAML. You get the same error when you try to do:
HAML will choke on that since it doesn’t know how to render the
ifstatement within the partial file (based on spacing, location of the if statement within it, etc.). Same thing applies with other code helpers like the tabs you’re using.