Multiple File Uploads with Paperclip & Rails 3 (Screencast)

Rails 3 Multiple File Uploads

Head over to Github and grab the full source of this application. More show notes will be online soon.

  1. A2a80673fd2f6d185c61defd4410f42a

    Laen

    5:37 AM on Saturday, February 19th, 2011

    Thanks! This is excellent.

  2. 74c02dbdaf622ad93214a10bc680046e

    Adam21e

    9:49 AM on Wednesday, March 9th, 2011

    Thanks for the great screencast, much appreciated. :-)

    I was wondering if you knew how to add validations to the model (eg validates :title, :presence => true) and have the attachments preserved if the title is missing so they don't need to be uploaded again.

  3. F64504e4eddbf96e60cdff88a4dde762

    David Tidwell

    8:27 AM on Thursday, March 10th, 2011

    Hi, just wanted to thank you for this. I watched your tutorial before, but it was back in rails 2, so I'm really excited to watch this in rails 3!

  4. 9f0c665fa2da29985be5f31bf19a4eca

    Chris

    8:41 AM on Thursday, April 21st, 2011

    How do you show these images in the views. When I do post.assets[0].url I get url is an undefined method. How else could you grab the url to generate an image with the image tag outside of the form as shown in the screencast?

  5. 30352c63a09d6ac86171756b242d3222

    seamusjr

    9:56 PM on Sunday, August 14th, 2011

    Great tutorial for adding multiple images to models with paperclip in rails 3. To answer Chris's question, you can do this in the show page to iterate through your image collection.


  6. 30352c63a09d6ac86171756b242d3222

    seamusjr

    10:01 PM on Sunday, August 14th, 2011

    To answer Chris's question, you can do this in the show page to iterate through your image collection:
    https://gist.github.com/1145350

  7. 802150025e2e8b524e4d5f01259738dc

    rmagnum2002

    11:10 PM on Wednesday, September 7th, 2011

    https://gist.github.com/1145350
    this isn't working..


    gave me an error

    undefined method `assets' for nil:NilClass

    Extracted source (around line #12):

    9:
    10:
    11:
    12:
    ...

    please help. thanks

  8. 802150025e2e8b524e4d5f01259738dc

    rmagnum2002

    12:46 PM on Thursday, September 8th, 2011

    how can you take one asset to the index.html?

    I mean display a thumb next to the post.
    And how can you limit the upload files? cause I can upload 5 then edit the post and upload 5 more and so on.. ending up having more images than needed

  9. C67ef9a039231500c82e6f00218946fa

    Emils

    5:09 PM on Wednesday, September 21st, 2011

    Great screencast !

    But
    When I try to upload an image, I get - ActiveRecord::UnknownAttributeError (unknown attribute: image).

    Anyone has this issue?
    Any solutions ?

    I noticed that this app from git hub is on rails 3.0.3 (My app 3.1.0) - Could this be the case ?

    Thanks!

  10. B57f81d2e20714436fa85b1c2cc19183

    Hunter Husar

    1:14 AM on Thursday, October 6th, 2011

    Thank you! Very great tutorial very helpful :) !

  11. F80c5168b92fe9d49b0668cde3bdd57c

    Gordon Yeong

    8:12 AM on Monday, October 10th, 2011

    thanks for doing this. I too did multi images uploads using rails 2.3.8 but with a new project on rails 3, your guide provided me opportunity to further simplify my code. On rails 2.3.8, i relied on js to dynamically create more file fields in the view but with yours, i just calculated the number of new file fields required when the 'update' message is sent to the resource controller :)
    Sweet :D

  12. 41e5f83acb50296ace67e8a30c551fb1

    Prashanth

    5:12 AM on Sunday, December 18th, 2011

    Great screencast, saved my day!!

    Keep them coming :)

  13. 565cf7871155cca5be71f74f3a3334a7

    Steve

    1:30 AM on Wednesday, December 28th, 2011

    Thanks for this screencast. VERY helpful. I seem to be having a problem with displaying the attachments in my show view. Can you email me the code you use in your show view? I appreciate your work on this topic.