best_in_place을 레일 애플리케이션에 구현하려고하는데이를 구현하는 방법을 알 수 없습니다. 편집해야하는 텍스트를 스크롤 할 때 아무 것도하지 않습니다. 사용자 아래에 중첩 된 프로필 모델이 있으며 사용자 이름을 편집하고 싶습니다. 그러나 이름은 프로필 모델에 있습니다. 그래서 나는 "user.profile.name"을 가지고있다. 내가 설치 단계를 folowed 보석을 포함하고 설치하고 내 application.js에 언급 된 jquery 파일을 포함! , HTML :레일 Best_in_place 편집 문제
respond_to :
여기def show
@user = User.find_by_identifier!(params[:id])
@profile = @user.profile
end
내 프로필 컨트롤러 : 여기
<%= best_in_place @profile, :name, :type => :input, :path => user_profile_path(@user) %>
사용자 컨트롤러 내 show 액션입니다 : 여기
내 쇼이다 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
아무 것도 나타나지 않습니다. 그것도 내가 설치되어있는 곳에서 최고의 것을 가지고 있지 않습니까? 그것은 노이징을합니다. 하드 코딩 된 이름 만 표시합니다! – pratski
best_in_place가 설치되지 않은 경우,'<% = best_in_place ... %>'의 뷰 렌더링 중에 오류가 발생합니다. 그것은 확실히 자바 스크립트 문제입니다. 페이지 로딩시 javascript 오류가 없는지, best_in_place javascript 파일이 있는지 확인하고 디버그하여 잘못된 것을 찾으십시오. -/ – Baldrick