铁路3.2.11
的Gemfile:
gem 'jquery-rails'
gem "best_in_place"
Run Code Online (Sandbox Code Playgroud)
aplication.js
//= require jquery
//= require jquery_ujs
//= require best_in_place
Run Code Online (Sandbox Code Playgroud)
post.js.coffee
jQuery ->
$('.best_in_place').best_in_place()
Run Code Online (Sandbox Code Playgroud)
show.html.erb
<%= best_in_place @post, :title %>
Run Code Online (Sandbox Code Playgroud)
查看内联表单,但我得到了js异常,没有任何东西被触发,松散焦点等追溯:
Uncaught SyntaxError: Unexpected token u jquery.js:525
jQuery.extend.parseJSON jquery.js:525
BestInPlaceEditor.setHtmlAttributes best_in_place.js:265
BestInPlaceEditor.forms.input.activateForm best_in_place.js:309
BestInPlaceEditor.activate best_in_place.js:54
BestInPlaceEditor.clickHandler best_in_place.js:260
jQuery.event.dispatch jquery.js:3046
elemData.handle
Run Code Online (Sandbox Code Playgroud)
在jquery.js的行
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
Run Code Online (Sandbox Code Playgroud)
我怎么能解决这个问题?
upd问题解决了.做同样的改变但一切正常.魔法 ;)