rails 3 best_in_place edit not working without refreshing the page

蓝咒 提交于 2019-12-04 12:02:49

I encountered the same problem, and my solution is add $('.best_in_place').best_in_place(); to the create.js.erb file.

This is because you are not wiring the in-line-edit javascript plugin to the newly created HTML element (that holds the name to be editable) after completing the ajax call. I tried to look at your source code on Github, but it looks outdated.

Your controller isn't responding to JSON for the update method. Pretty simple to fix: simply add something like the following to your update action.

def update
  ...
  respond_to do |format|
    format.html { redirect_to @user}
    format.json { render json: @user }
  end
  ...
end
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!