首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >怎样才能让best_in_place的respond_with_bip正常工作?

怎样才能让best_in_place的respond_with_bip正常工作?
EN

Stack Overflow用户
提问于 2012-12-12 04:18:18
回答 1查看 1.3K关注 0票数 19

我在获取best_in_place的完整功能时遇到了问题。问题是,一旦我编辑了一个字段,为了能够点击并再次编辑该字段,我需要刷新页面。我可能错了,但我有一种感觉,这与respond_with_bip抛出一个undefined method错误有关。我认为这与没有将best_in_place资产放在正确的位置有关。目前,我有以下更新‘常量’的工作。但是当它命中respond_with_bip时,它又抛出了一个错误

秀:

代码语言:javascript
运行
复制
<%= best_in_place constant, :description %>

控制器的更新操作:

代码语言:javascript
运行
复制
def update
  @constant = Constant.find(params[:id])

  respond_to do |format|
    if @constant.update_attributes(params[:constant])
      format.html { 
        flash[:success] = "Constant Updated"
        redirect_to settings_path
      }
      format.json { 
        respond_with_bip(@constant) 
      }
    else
      format.html { 
        flash[:error] = "Constant Update Failed"
        @title = "Constants"
        @constant = Constant.new
        @partial_path = "settings/constants"
        redirect_to settings_path
      }
      format.json { respond_with_bip(@constant) }
    end
  end
end

best_in_place的github页面上的文件夹而言,我将整个lib/best_in_place文件夹放在了我的应用程序的app/assets文件夹中。javascript文件在app/assets/javascripts中(这些文件可以正常工作,所以不用担心)。我把lib/assets/best_in_place.rb文件放在了config/initializers文件夹中。

我做错了什么?

EN

回答 1

Stack Overflow用户

发布于 2015-09-10 23:57:41

这可能有帮助,https://github.com/bernat/best_in_place/issues/220。从我在那里看到的,它看起来是一个空白,这就是抛出你得到的错误。如果你不需要使用它,你可以随时使用:

代码语言:javascript
运行
复制
redirect_to @constant
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13827829

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档