Use jquery.turbolinks gem to solve the js bugs.