2012-09-26 2 views
0

을 알아낼 수 없습니다 예 :레일 3 편집 best_in_place 중첩 된 모델

:

best_in_place incident, :notes, type: :input, nil: 'Add Note' 

하지만 (고객 사건 belongs_to) Customer.all의 드롭 다운을 얻기 위해 incident.customer을 수행하는 방법을 알아낼 수 없습니다

다양한 방법으로 여러 가지 오류가 발생합니다.

= best_in_place incident, :notes, :type => :select, :collection => @customer 

이는 [[A, B], [C를 생산 :보기에

@customer = Customer.all.map { |c| [c.id, c.customer_name] } # or whatever the customer name attribute is 

: 나는 당신의 컨트롤러의 show 액션에, 제대로 이해, 또는 어디든지 관련이 경우

답변

1

, d]] 형식이 필요합니다.

Customer.pluck (: id, : name)은 단어가 적지 만 작성시에는 Edge 레일에만 있습니다 (link to guides).