我无法获取 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/