5

기본적으로 나는 사용자가 자신의 프로필 정보를 편집 할 수 있도록 내 레일 webapp에서 best_in_place를 사용하고 있습니다. 문제는 여기에 .. 나는 사용자가 특정 항목에 대한 선행 입력 양식을 제시하고 싶습니다이다 내가 함께 일하고 있어요 무엇 :best_in_place를 트위터 부트 스트랩의 선행 기입으로 사용할 수 있습니까?

<p>College/University: <input type="text" class="span3" style="margin: 0 auto;" data-provide="typeahead" data-items="8" data-source='["University of Pennsylvania","Harvard","Yale","Princeton","Cornell","Brown","Columbia","Dartmouth"]'></p> 

이 나에게 선행 입력과 함께 작업 폼 상자를 제공합니다. 그러나 나는 그들이 텍스트를 클릭하면 사용자 만 선행 입력 양식을 볼 수 있도록하고 상자에서 멀리 클릭하거나 선택이 입력 타격에

<%= best_in_place @student, :education %> 

처럼 뭔가 best_in_place이 포장 할 수 있도록하려면 데이터베이스에 저장됩니다.

이렇게하는 것이 쉬운 방법이 있습니까?

+1

참조 http://stackoverflow.com/questions/14796415/how-to-use-best-in-place-with-twitter-bootstrap –

답변

0

best_in_place과 같은 임의의 루비 온 레일 도움말에서 :html_attrs 옵션을 추가하기 만하면됩니다. 다음은 내 모습을 보여주는 샘플입니다.

<%= best_in_place @student, :education, :type=> :input, 
    :html_attrs => {:'data-provide' => "typeahead", // Any other attributes 
        :'data-source' => '["University of Pennsylvania","Harvard","Yale","Princeton","Cornell","Brown","Columbia","Dartmouth"]' %> 

희망이 있습니다.

관련 문제