How do you upload multiple images with paperclip?

Hey there, I want to be able to upload multiple images at once on my website. I can only upload one image at a time at the moment. Can anybody lead me in the right direction? Here's my code

/app/models/listing.rb

class Listing < ActiveRecord::Base has_attached_file :image, :styles => { :medium => "200x", :thumb => "100x100>" }, :default_url => "default.jpg"
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
end
____________________________________________________________________________

/app/controllers/listings_controller.rb

...
private
def set_listing
@listing = Listing.find(params[:id])
end

def listing_params
params.require(:listing).permit(:name, :description, :price, :image)
end
end

____________________________________________________________________________

/app/views/listings/_form.html.erb

<%= form_for @listing, :html => { :multipart => true } do |f| %>
...
...

<%= f.file_field :image, class: "form-control" %>
<%= f.submit class: "btn btn-primary" %>

<% end %>

____________________________________________________________________________

/app/views/listings/show.html.erb

<%= notice %>

<%= image_tag @listing.image.url(:medium) %>
...

____________________________________________________________________________

/app/views/listings/index.html.erb

Listing listings

...

<% @listings.each do |listing| %>

...

____________________________________________________________________________

Leave a Comment

Image Name
<%= image_tag listing.image.url(:medium) %> <%= listing.name %>