2012-11-03 50 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。感謝那些看過。

相關問題