DISQUS

DISQUS Hello! Pete On Rails is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

Adding Multiple Attachements to a Model in one View

Started by peteonrails · 12 months ago

AttachmentFu is a great plugin. It’s heavily used all over the place to upload images to a Rails app. It’s also good with other file types.

I had a requirement to provide users with the ability to set up an entity (call it a Batch), then upload a number of CSV files to that batch. I [...] ... Continue reading »

4 comments

  • Does the fields_for block work in this instance with af.file_field because you used javascript to create multiple upload fields? Without javascript, would you be stuck using file_field_tag to upload multiple files using attachment fu, and as a result not being able to use the fields_for block?

    Thank you!,
    John
  • ...continued to from last post...

    ...as a result not being able to use the fields_for block?...thereby not being able to use one field to work with two models?
  • ...edit from last post...

    ...as a result not being able to use the fields_for block?...thereby not being able to use one FORM to work with two models?
  • No, it'll work without javascript if you expect that in your application. Instead of having this line of code produce a javascript enabled link that dynamically inserts a new file_field box:

    <%= add_attachment_link "Add a File" %>

    You can instead have it post the form and return to the edit view with another empty file_field box.

    It should still work with af.file_field.

    Do you have an example of code that isn't working? If so, point me to it and I'll take a look.

Add New Comment

Returning? Login