Interestingly, moving the begin/rescue to a helper did not solve the
problem. I now have a very simple/clean haml template:
- cache(path=cache_path('_menu')) do
- prep_menu_render
- wrap_cache(path) do
= menu_render_custom_or_default
and the following helper functions:
def prep_menu_render
@site.parse_url(adjusted_path,flash[:group_label]) unless
@site.parsed
db_item(@site) ? @site.setup_menus :
@site.setup_menus_for_no_exist
@menu_width=get_locals()[:menu_width]
end
def menu_render_custom_or_default
locals = {:menu_width => @menu_width}
begin
render(:file => @site.custom_template('menu'), :locals =>
locals)
rescue #ActionView::TemplateError, ActionView::ActionViewError,
Errno::ENOENT
render(:file => 'templates/menu', :locals => locals)
end
end
and when the template file in the begin clause is missing, I get
nothing back in the browser - empty page.
And again, if I convert the above template to erb, it works properly.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---