Trying to implement multiple images upload using Paperclip gem. I can see two images files in the parameters but I am getting an error no handler found for [].
views/passengerride/_form.html.erb:
<%= form_for @passengerride, :html => { :multipart => true} do |f| %>
<div class="form-group ">
<div class="control-label col-sm-2 requiredFiel">
<%= f.label :title %>
</div>
<div class="col-sm-8">
<%= f.text_field :title, class: "select form-control", placeholder: "Eg: Bedroom" %>
</div>
</div>
<div class="form-group ">
<div class="control-label col-sm-2 requiredFiel">
<%= f.label :image %>
</div>
<div class="col-sm-8">
<%= f.file_field :image, class: "select form-control", placeholder: "Eg: Bedroom", multiple: true %>
</div>
</div>
<% end %>
passengerrides_controller.rb:
def passengerride_params
params.require(:passengerride).permit(:title, { image: :preview })
end
passengerride.rb:
has_attached_file :image,
url: "/system/:hash.:extension",
hash_secret: "abc123"
validates_attachment :image,
styles: { original: ['500x500>', :jpg] },
content_type: { content_type: ["image/jpeg", "image/jpg", "image/gif", "image/png"] },
presence: true,
size: { in: 0..5000.kilobytes }
Aucun commentaire:
Enregistrer un commentaire