2012-11-03 42 views
0

我添加了best_in_place gem到我的项目,更新不会生效,直到页面重新加载发生。我可以在我的show view中看到它,但它需要重新加载页面。为什么是这样?best_in_place gem,查看不显示更新的编辑没有页面重新加载

我的列表控制器:

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-

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 -

//= 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文件的顺序?我在这里忽略了什么让更新不带页面重新加载?感谢您的关注。

回答

1

我只是忘了在我的列表控制器的顶部添加respond_to :json。感谢那些看过。

相关问题