Search code examples
ruby-on-railspaperclipruby-on-rails-pluginspolymorphism

Polymorphic Paperclip Plugin with multiple picture uploads


I have used paperclip polymorphic plugin to track my attachments. The tutorialwhich I have been through has used single attachments(image) http://burm.net/2008/10/17/ruby-on-rails-polymorphic-paperclip-plugin-tutorial/.

How do i enable multiple images with this plugin?

Thanks.


Solution

  • You have to make some changes to the code.

    <p>
      Attach a file or image <br />
      <%= f.file_field :data%>
    </p>
    

    The upper code should be

    <%= file_field_tag 'model[data][]'%>
    <%= file_field_tag 'model[data][]'%>
    

    This will allow you to add 2 images.

    Hope this helps.