我使用回形针在rails中上传图片。当我上传图片时,我收到了类似 Errno :: EISDIR的错误: 是一个目录@ unlink_internal - / home / ubuntu / app / public ,这发生了间歇性的事。任何人给我解决方案。
我的模型文件
class DayCare < ActiveRecord::Base
has_attached_file :logo, :default_url => 'default.png'
# Validations
validates_attachment :logo, content_type: { content_type: /\A(image|video)\/.*\Z/ }
end
我的表格
<%= simple_form_for(resource, as: resource_name ,:id=>"registerform", url: registration_path(resource_name),html: { class: "form-horizontal"}) do |f| %>
<%- if resource.errors.any? %>
<%- f.object.errors.full_messages.each do |error_message| %>
<%= error_message%>
<%- end %>
<%- end %>
<%= f.input :email,required: true, autofocus: true,:placeholder => "Enter E-mail address",:label=>false,:input_html => { :class => "form-control" } %>
<%= f.input :password, required: true,:placeholder => "Choose Password",:label=>false,:input_html => { :class => "form-control" } %>
<%= f.input :password_confirmation, required: true,:placeholder => "Confirm Password",:label=>false,:input_html => { :class => "form-control" } %>
<%= f.simple_fields_for :day_care, @user.build_day_care do |d| %>
<%= d.input :name, :input_html => { :class => "form-control" },:placeholder => "Child Care Center",:label=>false %>
<%= d.input :address, :input_html => { :class => "form-control" },:placeholder => "Street Address",:label=>false %>
<%= d.input :logo, as: :file ,:input_html => { :class => "form-control" },:placeholder => "",:label=>false %>
<% end %>
<%= f.button :submit, "Agree and Continue",:class=>"btn btn-default signup_button" %>
<% end %>