我在获取best_in_place
的完整功能时遇到了问题。问题是,一旦我编辑了一个字段,为了能够点击并再次编辑该字段,我需要刷新页面。我可能错了,但我有一种感觉,这与respond_with_bip
抛出一个undefined method
错误有关。我认为这与没有将best_in_place
资产放在正确的位置有关。目前,我有以下更新‘常量’的工作。但是当它命中respond_with_bip
时,它又抛出了一个错误
秀:
<%= best_in_place constant, :description %>
控制器的更新操作:
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
文件夹中。
我做错了什么?
发布于 2015-09-10 23:57:41
这可能有帮助,https://github.com/bernat/best_in_place/issues/220。从我在那里看到的,它看起来是一个空白,这就是抛出你得到的错误。如果你不需要使用它,你可以随时使用:
redirect_to @constant
https://stackoverflow.com/questions/13827829
复制相似问题