当我在生产中将文件上传到我的应用程序时,我的应用程序的根目录中保存了一堆文件。这是否按预期工作?大约有8个文件,例如一个文件名为0fadc87e6e0b5ba2f3ba7fe15e4641c920150919-16509-1qkucnc
,除最后6个字符外,它们的名称相同。这是我的user.rb
has_attached_file :avatar, :styles => { :large => "500x500>",
:profile => "300x300>", :medium => "300x300>",
:thumb => "100x100>", :small => "36x36#",
:mini => "26x26#" },
:default_url => "/assets/logo.png",
:url => "/assets/users/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/users/:id/:style/:basename.:extension"
validates_attachment_content_type :avatar,
content_type: ["image/jpeg", "image/gif", "image/png"]
validates_attachment_size :avatar, :less_than => 5.megabytes
我也在使用cloud9