簡體   English   中英

Rails Best_in_place編輯問題

[英]Rails Best_in_place edit issue

我試圖在我的Rails應用程序中實現best_in_place ,但我不知道如何實現它。 當我滾動需要編輯的文本時,它只是不執行任何操作。 我在用戶下有一個嵌套的個人資料模型,我想編輯用戶名。 但是名稱在Profile Model下。 所以我有“ user.profile.name”。 如上所述,我已經按照安裝步驟進行了操作,包括並安裝了gem並在我的application.js中包括了jquery文件!

這是我的表演視圖:

<%= best_in_place @profile, :name, :type => :input, :path => user_profile_path(@user) %>

這是我在“用戶”控制器中的表演動作:

  def show
    @user = User.find_by_identifier!(params[:id])
    @profile = @user.profile
  end

這是我的個人檔案控制器:

response_to:html,:json

   def edit
     @user = User.find_by_identifier!(params[:user_id])
     @profile = @user.profile
   end

   def update
     @user = User.find_by_identifier!(params[:user_id])
     @profile = @user.profile
     @profile.update_attributes(params[:profile])
     respond_with @user
   end

這是我的application.js文件

//= require jquery
//= require jquery_ujs
//= require best_in_place
//= require best_in_place.purr
//= require_tree .

$(document).ready(function() {
  /* Activating Best In Place */
  jQuery(".best_in_place").best_in_place();
});

感謝@baldrick弄清楚了。 我還有另一個使用舊版本jQuery的jQuery插件。 我刪除了與該插件相關的JS,然后Best_in_Place工作正常。 唯一的問題是,我必須使用一個或另一個插件,因為它們發生沖突,或者找到了另一個插件可以使用新版本的jQuery的方法,因為新版本不支持某些功能。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM