I get this error:
undefined method `each' for nil:NilClass
Here:
<% @images.each do |image| %>
This is where I populate @images:
class Users::RegistrationsController < Devise::RegistrationsController
def edit
@images= Dir.glob("public/assets/images/users/#{current_user.id}/med/*")
super
end
...
I only get this error when i fail paperclip validation (as in image > 1mb)
has_attached_file :image, {styles: { small: "24x24#", med: "100x100#", large: "200x200#" },
:url => "/assets/images/users/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/images/users/:id/:style/:basename.:extension",
:default_url => "/assets/images/users/default/:style/default.png",
:keep_old_files => true}
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
validates_attachment_size :image, :less_than => 1.megabytes
The thing is that I don't see how the file upload fail is supposed to be handled.
Aucun commentaire:
Enregistrer un commentaire