I have a Rails partial to load my header on all pages ..
_header.html.erb:
<ul class="nav navbar-nav">
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Top Itens!", itens_path %></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"> Mais! <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><%= link_to "Sobre", sobre_path %></li>
<li><%= link_to "Privacidade", privacidade_path %></li>
<li><%= link_to "Termos", termos_path %></li>
<li><%= link_to "Contato", contato_path %></li>
</ul>
</li>
</ul>
JQuery:
$('.nav li').click(function() {
$(this).siblings('li').removeClass('active');
$(this).addClass('active');
});
The problem is that every time the page is reloaded, '.nav li' comes back without the active class. How should I proceed?