这是我在 /app/library/stone.rb 中的模型
class Library::Stone < ActiveRecord::Base
attr_accessible :group, :healing, :life, :logo, :magic, :name, :other, :place, :structure, :view
mount_uploader :logo, LogoUploader
before_save :cap_group
def cap_group
self.name = self.name.mb_chars.capitalize.to_s
self.group = self.name[0]
end
end
这是上传器 /app/uploaders/logo_uploader.rb
class LogoUploader < CarrierWave::Uploader::Base
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :thumb do
process :resize_to_limit => [200, 300]
end
end
问题是这在控制台中有效,但是当我在浏览器中尝试时,图像没有正确上传。我认为这是因为不知何故