I added an accordion for an attachment within index.html.erb where I have two tabs named 'users' and 'attachments'.
I also have resource routes defined for both users and attachments.
navbar links
<li><%= link_to "Users", users_path %></li>
<li><%= link_to "Attachments", attachments_path %></li>
When I refresh the page from within the attachments tab and refresh the page I can see the accordion, but when I open the attachment tab with a link_to, I can't see the accordion.
How can I always see the accordion when I am in /attachments route
Edit
attachment.js
$(document).ready(function() {
$(".accordion").accordion( { collapsible: true } );
});
index.html.erb (just necessary part)
<div class="accordion">
<% Here some condition with each do |a| %>
<h3><%= a %></h3>
<div>
<% Here some condition with each do |b| %>
<p><%= b %></p>
<% end %>
</div>
<% end %>
</div>