2011-08-15 28 views
1

動的フォームを動作させるためにRailsCastの例を試しましたが、正しく動作させることができませんでした。基本的に私はhas_manyタスクを持つプロジェクトを持っており、プロジェクトを作成または編集するときに、タスクを動的に追加および削除できるようにしたいと考えています。これどうやってするの?Rails 3.1動的ネストされたフォーム

+0

は、あなたのCをGISTかを示すことができましたオデ?私はあなたに手を差し伸べることができた! – 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 
関連する問題