Jquery and accepts_nested_attributes_for model creation


#1

I am getting lost in dynamically creating Asset objects while creating
a new Project. I am using the new accepts_nested_attributes_for method
in Rails 2.3 and have this close to working, I just can’t figure out
what my custom controller method “add_asset” should be doing here. I
am using jQuery instead of Prototype.

Here is the relevant code:
http://pastie.org/private/oom26fy67vkahsamjpvg

I know that the new asset isn’t getting built, and I need to do that
in the add_asset controller action, but I also don’t know how to
generate a file_field for that object whenever it’s created.

Right now the file_field that’s getting generated using nested_for is:

but my input field from the add_asset controller method is:

Any help would be appreciated. I’ve been staring at this all day long!


#2

I have the same problem, any idea ?

yaphi wrote:

Here is the relevant code:
http://pastie.org/private/oom26fy67vkahsamjpvg

I know that the new asset isn’t getting built, and I need to do that
in the add_asset controller action, but I also don’t know how to
generate a file_field for that object whenever it’s created.

Any help would be appreciated. I’ve been staring at this all day long!