载波默认store_dir

时间:2019-01-10 09:53:41

标签: ruby-on-rails file-upload carrierwave uploader

默认情况下,Carrierwave会应用以下上传器路径:

  # Override the directory where uploaded files will be stored.
  # This is a sensible default for uploaders that are meant to be mounted:
  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

我想知道将model.id放在mounted_as之前是否存在任何错误:

  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{model.id}/#{mounted_as}"
  end

所以例如:

uploads/user/123/avatar

相比,

是合法的路径

uploads/user/avatar/123

0 个答案:

没有答案