Rails 3.2.11
gem 文件:
gem 'jquery-rails'
gem "best_in_place"
应用程序.js
//= require jquery
//= require jquery_ujs
//= require best_in_place
post.js.咖啡
jQuery ->
$('.best_in_place').best_in_place()
show.html.erb
<%= best_in_place @post, :title %>
查看了内联表单,但我遇到了 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
jquery.js 中的行
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
我该如何解决这个问题?
更新问题已解决。做同样的改变,但一切正常。魔法;)
最佳答案
在我的例子中,使用 gem 的 git 版本解决了这个问题。
gem 'best_in_place',github:'bernat/best_in_place'
关于ruby-on-rails - best_in_place gem 初始化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14466158/