Initializing pearls best_in_place

rails 3.2.11

Gemfile:

gem 'jquery-rails'
gem "best_in_place"

aplication.js

//= require jquery
//= require jquery_ujs
//= require best_in_place

post.js.coffee

jQuery ->
  $('.best_in_place').best_in_place()

show.html.erb

<%= best_in_place @post, :title %>

the inline form is being scanned, but I got a js exception and didn’t run anything on login, focus loss, etc. traceback:

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

in jquery.js

if ( window.JSON && window.JSON.parse ) {
  return window.JSON.parse( data );

how can i fix this?

update problem . make the same changes, but everything works fine. magic;)

+5
source share
2 answers

Using the git gem version resolved this in my case.

gem 'best_in_place', github: 'bernat/best_in_place'

+3
source

perhaps you should change

jQuery ->
  $('.best_in_place').best_in_place()

to

jQuery ($) ->
  $('.best_in_place').best_in_place()
0
source

All Articles