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: <input id="project_assets_attributes_new_1_asset" type="file" size="30" name="project[assets_attributes][new_1][asset]"/> but my input field from the add_asset controller method is: <input id="project_assets" type="file" size="30" name="project [assets]"/> Any help would be appreciated. I''ve been staring at this all day long! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Remy Even
2009-Apr-02 23:16 UTC
Re: jquery and accepts_nested_attributes_for model creation
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!-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---