2011-08-15 3 views
1

Я попытался выполнить пример RailsCasts, чтобы получить динамические формы для работы, но не смог заставить его работать правильно. В основном у меня есть проект, у которого есть много задач, и я хочу иметь возможность динамически добавлять и удалять задачи при создании или редактировании проекта. Как я могу это сделать?Rails 3.1 динамические вложенные формы

+0

Не могли бы вы представить или показать свой c ода? Я мог бы дать вам руку! – LearningRoR

ответ

1

Apneadiving - это правильно, но это не помогает новому парню.

Это только для рубинов на рейках 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 
Смежные вопросы