I\'m busy learning Rails 4 and I would like to display a bootstrap popup modal when a user clicks on a link, when the modal opens it needs to show the information relating to th
Have a try with another way. In this way, we are going to show the modal popup using explicit javascript command.
In index.html.erb
<%= link_to "view", work_path(w), remote: true, class: 'static-popup-link'%>
In application.js
$(document).ready(function() {
var clickOnPopupLink = function(){
$('body').on('click', '.static-popup-link', function(){
$('#myModal').modal('show');
});
}
clickOnPopupLink();
});
In controller
def show
@work = Work.find(params[:id])
end
In show.js.erb
$('#myModal').html("<%= j render("/works/modal")%>")