1

I tried following the RailsCasts example to get dynamic forms to work but couldn't get it working right. Basically I have a Project that has_many tasks and I want to be able to dynamically add and remove tasks when creating or editing a project. How can I do this?

1
  • Could you gist or show your code? I could give you a hand! Commented Aug 17, 2011 at 15:30

2 Answers 2

2

Use Ryan Bate's gem directly.

It lies here with documentation. BTW the documentation precisely describes your use case.

Sign up to request clarification or add additional context in comments.

Comments

1

Apneadiving is right, but it doesn't really help the new guy.

This is only for ruby on rails 3.1 and probably for 3.2 but I haven't tested it.

If you add the following to your Application_root/app/assets/javascripts/application.js file (I added it to the last line):

//= require jquery_nested_form

a fresh one looks as follows

// 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   

Or if you are for some reason using prototype:

// 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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.