werein / x-editable-rails

Edit fields easily with X-Editable helper

Home Page:https://wereinhq.com/guides/x-editable-rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnCaught type error

joegiralt opened this issue · comments

Hey guys, love the gem.
everything seems to be working fine.
When I edit a field, the field is updated on the back end. which is great.
the popup or the inline edit field hangs there with the loading gif and doesn't disappear.
If i refresh the page the field is up dated properly.

These are the errors from my browser console

Uncaught TypeError: Cannot read property 'errors' of undefined error_handling.js?body=1:5
$.fn.editable.defaults.error error_handling.js?body=1:5
(anonymous function) bootstrap-editable.js?body=1:294
proxy jquery.js?body=1:828
fire jquery.js?body=1:3049
self.fireWith jquery.js?body=1:3161
done jquery.js?body=1:8238
callback

How do I make the loading gif disappear?

Thanks again!

Hi, do you respond to JSON? For immediately fix you can use instead
#= require editable/rails
this

#= require editable/rails/editable_form
#= require editable/rails/data_classes

it'll skip better error handler: #16

Thanks Jiri! this fixed the Issue!

On Fri, Dec 27, 2013 at 8:45 AM, Jiri Kolarik notifications@github.comwrote:

Hi, do you respond to JSON? For immediately fix you can use instead
#= require editable/rails
this

#= require editable/rails/editable_form
#= require editable/rails/data_classes

it'll skip better error handler: #16#16


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-31260717
.

Blog: http://www.weatherlightus.tumblr.com
LinkedIn: http://linkedin.com/in/giralt
Twitter: https://twitter.com/joegiralt

My pleasure :) Can you tell me which one fixed the issue? If respond to JSON or require editable_form/data_classes?

rendering json fixed the problem :p
This fixed the problem .

 def update
    survey = Teacher::Survey.new params[:survey]
    if (survey.update_attributes(params[:survey].keys, current_user)) then
      render json: {success: true}
    else
      render json: {errors: survey.errors}, status: 400
    end
  end

On Dec 27, 2013, at 3:16 PM, Jiri Kolarik notifications@github.com wrote:

My pleasure :) Can you tell me which one fixed the issue? If respond to JSON or require editable_form/data_classes?


Reply to this email directly or view it on GitHub.

Thanks for this code, it might be helpful for someone.