0
이것은 내 사이드 바에로드하지 않는 것 같습니다. 레일즈 4의 Turbolinks와 관련이 있다고 생각합니다. 페이지를 새로 고침하면 작동하는 것 같습니다. 작동 시키려면이 방법을 변경하는 방법에 대한 아이디어가 있습니까?레일 4 터보 링크 커피 스크립트가로드되지 않습니다.
jQuery ->
category = $('#subject_category').html()
$('#subject_product').change ->
product = $('#subject_product :selected').text()
escaped_product = product.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1')
options = $(category).filter("optgroup[label='#{escaped_product}']").html()
if options
$('#subject_category').html(options)
$('#subject_category').parent().show()
else
$('#subject_category').empty()
$('#subject_category').parent().hide()
$ ->
category = $('#sidebar .category_select').html()
options = $(category).filter("optgroup[label='Car']").html()
if options
$('#sidebar .category_select').html(options)
$('#sidebar .category_select').parent().show()
else
$('#sidebar .category_select').empty()
$('#sidebar .category_select').parent().hide()
제 커피 스크립트 구문에 문제가 있습니다. 다른 게시물에서 내 요청을 처리하지 못했습니다. 이것들은 onload 이벤트가 아니기 때문에 – user2012677
'$ ->'는'jQuery ->'의 지름길이며'document ready'의 지름길입니다. 이 포스트는 turbolinks와'document ready'에 대해 다른 것을 설명하고 그것이 당신의 문제라고 확신합니다. – slowjack2k
그래서'$ ->'를'$ (document) .on "터보 링크로 대체해야합니다 : load", ->', 이것이 정확합니까? 'jQuery ->'단축키는 무엇입니까? 'jQuery ->'를'$ (document) .on "turbolinks : load", ->'로 대체해야합니까? – user2012677