2017-10-27 1 views
3

인덱스 페이지에서 다음을 편집하려면 어떻게해야합니까? 내가 최고의 장소에 보석을 시도 뷰 한 다음 index 액션레일 인라인 편집

<% @request.each do |s| %> 
    <%= s.message %> 
    <%= s.date %> 
<% end %> 

을 편집 인라인 및 업데이트 할 수 있도록하고 싶습니다하지만 난 <퍼센트을 시도 할 때마다 내가 지금 제대로 작동 나던 = best_in_place @request, : message %> 알려지지 않은 메소드 오류 메시지를 발생시킵니다. Is this this <%= best_in_place @request, :message %> this with this <%= s.message %>

레일즈 버전 5.1.4에서 가장 잘 작동하며 인라인 편집을 어떻게 작동시킬 수 있습니까?

답변

0

최상의 레일즈 버전 5.1.4에서 작동합니까? 인라인 편집이 어떻게 작동합니까?

예, 작동합니다. jQuery가 필요하고 보석 및 JS 라이브러리를 추가해야합니다. jQuery를 들어

:

은 application.js에서 다음
$ yarn add jquery 

파일 :

best_in_place를 들어
//= require jquery 

에서, Gemfile에 보석을 추가 : 다음

gem 'best_in_place', '~> 3.0.1' 

라이브러리 귀하의 application.js 파일 :

//= require jquery 
//= require best_in_place 
... 

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

jquery 바로 다음에 best_in_place js가 있고 동일한 파일에서 초기화가 표시됩니다. 동일한 파일에서 초기화하려면 //= require_tree .을 추가해야합니다. 나는 #에 대한 정의되지 않은 메서드`message_path '의 오류가

<% @request.each do |request| %> 
    <%= best_in_place request, :message %> 
    ... 
<% end %> 
+0

<# <클래스 : 0x00007f1cb32834e0> : 0x00007f1cb301b720> – John

+0

당신이 보여줄 수

그런 다음보기에 당신은 개체와 속성을 전달해야 당신의 실제 코드는 무엇입니까? 지금 오류를 제기하고 있습니까? –

+0

<% = best_in_place request, : message %> – John