ruby-on-rails-3.1 - 如何让 best_in_place 的 respond_with_bip 工作?

标签 ruby-on-rails-3.1 best-in-place

我无法获取 best_in_place功能齐全。问题是,一旦我编辑了一个字段,为了能够再次单击并编辑该字段,我需要刷新页面。我可能错了,但我感觉这与 respond_with_bip 有关 throw undefined method错误。我认为这与不放置 best_in_place 有关。 Assets 在正确的地方。目前,我有以下内容可以更新“常量”。但是当它到达 respond_with_bip 时再次抛出错误。 :

显示:

<%= best_in_place constant, :description %>

Controller 更新 Action :
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 中的文件文件夹。

我究竟做错了什么?

最佳答案

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

redirect_to @constant

关于ruby-on-rails-3.1 - 如何让 best_in_place 的 respond_with_bip 工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13827829/

相关文章:

ruby-on-rails - 我们可以从 View 调用 Controller 的方法吗(理想情况下我们从 helper 调用)?

ruby-on-rails - 使用 Rails gem 'best_in_place' 进行内联编辑 - 错误 : new lines are lost after edit on textarea

ruby - ActionMailer 不在 Rails 3.1.1 中发送邮件

ruby-on-rails - 在 SCSS 部分中使用 Rails 3.1 Assets 路径

ruby-on-rails - Ruby 语法 : break out from 'each.. do..' block

hash - 从 Ruby on Rails 数据库准备要在 d3.js 中绘制的数据

ruby-on-rails-4 - Best_in_place 集合 1 对多关联

ruby-on-rails-3 - best_in_place 日期选择器格式

jquery - 如何在完成 best_in_place 编辑后触发事件?