小编ole*_*yan的帖子

best_in_place gem初始化

铁路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问题解决了.做同样的改变但一切正常.魔法 ;)

ruby-on-rails best-in-place

5
推荐指数
1
解决办法
959
查看次数

标签 统计

best-in-place ×1

ruby-on-rails ×1