I have a navigation menu and I want to highlight the links if it or any of its children are active.
My menu comprises the following code:
<ul>
<li class="first <%= current_page?(controller: 'posts', action: params[:action]) ? 'current' : '' %>"><%= link_to "Blog", blog_path %></li>
<li class="<%= current_page?(controller: 'organisations', action: params[:action]) ? 'current' : '' %>"><%= link_to "Organisations", organisations_path %></li>
<li class="<%= current_page?(controller: 'events', action: params[:action]) ? 'current' : '' %>"><%= link_to "Events", events_path %></li>
<li class="<%= current_page?(controller: 'pages', action: 'about') ? 'current' : '' %>"><%= link_to "About", about_path %></li>
<li class="<%= current_page?(controller: 'pages', action: 'contact') ? 'current' : '' %>"><%= link_to "Contact", contact_path %></li>
<% if user_signed_in? %>
<li class="last <%= current_page?(controller: 'users', action: params[:action]) ? 'current' : '' %>">
<a href="#"><%= current_user.username %></a>
<ul>
<li class="first"><%= link_to "Your Account", users_control_panel_path %></li>
<li class="last"><%= link_to "Log out", destroy_user_session_path, method: "delete" %></li>
</il>
</li>
<% else %>
<li class="last <%= current_page?(controller: 'devise/sessions', action: 'new') ? 'current' : '' %>"><%= link_to "Log in", new_user_session_path %></li>
<% end %>
</ul>
This runs without a problem in the development environment. However, when I push to Heroku the page fails to load with an internal server error. From the logs:
2012-06-04T09:17:10+00:00 app[web.1]: Started GET "/organisations" for 2.124.94.147 at 2012-06-04 09:17:10 +0000
2012-06-04T09:17:10+00:00 app[web.1]: Processing by OrganisationsController#index as HTML
2012-06-04T09:17:11+00:00 app[web.1]: Rendered organisations/index.html.erb within layouts/application (103.1ms)
2012-06-04T09:17:11+00:00 app[web.1]: Rendered layouts/_shim.html.erb (0.2ms)
2012-06-04T09:17:11+00:00 app[web.1]: Rendered layouts/_head.html.erb (1.9ms)
2012-06-04T09:17:11+00:00 app[web.1]: Rendered layouts/_header.html.erb (100.2ms)
2012-06-04T09:17:11+00:00 app[web.1]: Completed 500 Internal Server Error in 294ms
2012-06-04T09:17:11+00:00 app[web.1]:
2012-06-04T09:17:11+00:00 app[web.1]: ActionController::RoutingError (No route matches {:controller=>"users"}):
2012-06-04T09:17:11+00:00 app[web.1]: app/views/layouts/_header.html.erb:16:in `_app_views_layouts__header_html_erb___3404956210772716386_32718660'
2012-06-04T09:17:11+00:00 app[web.1]: app/views/layouts/application.html.erb:10:in `_app_views_layouts_application_html_erb__4043808991853607868_39058420'
I have recenty change from WEBrick to Thin, both on Heroku and locally. There was no problem when using WEBrick, and the problem is not present locally. What is the issue or is there a better way to achieve this?