best_in_place gem,视图在不重新加载页面的情况下不显示更新的编辑 [英] best_in_place gem, view not displaying updated edit without page reload
问题描述
我将best_in_place gem添加到了我的项目中,并且该更新直到页面重新加载后才生效。我可以在显示视图中看到它闪烁,但是需要重新加载页面。为什么会这样?
I added the best_in_place gem to my project and the update does NOT take effect until a page reload has happened. I can see it flash in my show view but it requires a page reload. Why is this?
我的列表控制器:
respond_to :html, :xml, :js
def update
@list = List.find(params[:id])
@list.update_attributes(params[:list])
respond_with(@list, :location => list_url(@list))
end
我的列表显示视图-
<h2 class="page-header"><%= best_in_place @list, :name %></h2>
<h2 class="lead"><%= best_in_place @list, :description %></h2>
我的gemfile-
My gemfile-
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'best_in_place'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'jquery-ui-rails'
gem 'uglifier', '>= 1.0.3'
end
我的应用程序js清单-
My application js manifest -
//= require jquery
//= require jquery_ujs
//= require jquery.ui.datepicker
//= require justgage
//= require raphael.min
//= require jquery.purr
//= require best_in_place
//= require_tree .
我的清单咖啡-
jQuery ->
$('#task_due_date').datepicker
dateFormat: 'mm/dd/yy'
jQuery ->
$('.best_in_place').best_in_place()
可能是我的清单js文件?我在这里俯瞰什么以使更新无需重新加载页面即可进行?谢谢您的关注。
Could it be the order of my manifest js files? What am I overlooking here to get the update to take without a page reload? Thanks for your attention.
推荐答案
我只是忘了添加 respond_to:json
在我的列表控制器顶部。感谢那些看过的人。
I simply forgot to add the respond_to :json
at the top of my lists controller. Thanks to those that took a look.
这篇关于best_in_place gem,视图在不重新加载页面的情况下不显示更新的编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!