Just getting started with Rails, and I'm trying to create tables with interactive tables in Rails using loading tables. I managed to do this, however, it seems that the problem is that when I click on the line to the page of the show, then click the "Back" button on this page to return to the index view, and the number of rows clicked no longer works. I need to refresh the page for it to work again.
I looked at Rails 3 - How to make the entire row of a table clicked using jQuery along with other answers on the site. It seems to still work.
My code is as follows
Index page
<tr data-link="<%= source_path(source) %>">
<td><%= source.name %></td>
<td><%= source.description %></td>
<td><%= link_to truncate(source.url, :length => 40), source.url, :target => '_blank' %></td>
<td><%= source.category %></td>
<td><%= source.user.name if source.user %></td>
</tr>
application.js
jQuery(function($) {
$("tr[data-link]").click(function() {
window.location = this.dataset.link
});
})