Attempting to make table rows clickable links to "edit" pages. I've implemented this on other projects with no issues, but on this project cannot get it to function.
I'm using the method mentioned here: Making a table row into a link in Rails
This alone has worked in the past but in this project was not. Since we are using Turbolink's I've attempting to use the method mentioned here as well: Rails 4 turbo-link prevents jQuery scripts from working
There is absolutely no response and no errors when clicking a row. Heres my code
in views/students/index.html.erb:
<tbody>
<% @students.each do |student| %>
<tr data-link = "<%= edit_student_path(student) %>">
[… row info …]
</tr>
<% end %>
in assets/javascripts/students.js
$(document).on('turbolinks:load', function () {
$("tr[data-link]").click(function() {
window.location = this.data("link")
})
})
I can see in developer view that <%= edit_student_path(student) %>
is generating the correct link. In desperation I also tried linking the view to the javascript as shown here: how to load a Javascript file to rails html erb
That did not fix anything. The assets manifest and application.js appear to be correct as well. Any suggestions on what might be inhibiting the click event from triggering would be greatly appreciated.