2011-08-15 1 views
1

동적 폼을 작동 시키려면 RailsCast 예제를 따라했지만 올바르게 작동하지 못했습니다. 기본적으로 has_many 작업을 가진 프로젝트가 있고 프로젝트를 만들거나 편집 할 때 작업을 동적으로 추가 및 제거 할 수 있기를 원합니다. 어떻게해야합니까?레일 3.1 동적 중첩 된 폼

+0

송시? 나는 너에게 손을 댈 수 있었다! – LearningRoR

답변

1

실연은 옳지 만 새로운 사람에게는 도움이되지 않습니다.

이것은 레일 3.1의 루비 및 3.2에 대한 것일 뿐이지 만 테스트하지는 않았습니다. 당신은 당신의 Application_root/app/assets/javascripts/application.js 파일에 다음을 추가하면

은 (내가 마지막 줄에 추가) :

//= require jquery_nested_form

신선한 하나가

// This is a manifest file that'll be compiled into including all the files listed below. 
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 
// be included in the compiled file accessible from http://example.com/assets/application.js 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// the compiled file. 
// 
//= require jquery 
//= require jquery_ujs 
//= require_tree . 
//= require jquery_nested_form 

를 다음과 같이 보인다 또는 당신이있는 경우 어떤 이유로 프로토 타입을 사용합니다 :

// This is a manifest file that'll be compiled into including all the files listed below. 
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 
// be included in the compiled file accessible from http://example.com/assets/application.js 
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 
// the compiled file. 
// 
//= require jquery 
//= require jquery_ujs 
//= require_tree . 
//= require prototype_nested_form