Paperclip将文件保存在正确的文件夹中但提供了错误的URL

时间:2014-11-09 05:14:01

标签: ruby-on-rails paperclip

这是我的回形针启动器:

Paperclip.options[:command_path] = "/usr/local/bin/"
Paperclip::Attachment.default_options[:storage] = :fog
Paperclip::Attachment.default_options[:fog_credentials] = {:provider => "Local", :local_root => "#{Rails.root}/public/system"}
Paperclip::Attachment.default_options[:fog_directory] = ""
Paperclip::Attachment.default_options[:use_timestamp] = false

在我的模特中,我有:

class Car < ActiveRecord::Base
  has_attached_file :logo, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png", :url => "/system/cars/logo/:id/:style/:filename"
  validates_attachment_content_type :logo, :content_type => /\Aimage\/.*\Z/


end

但出于某些原因,我这样做: Car.last.logo.url我得到:http://localhost:3000/cars/logo/18/original/7450392a-5e39-11e4-9a87-bea65d182201.png而不是http://localhost:3000/system/cars/logo/18/original/7450392a-5e39-11e4-9a87-bea65d182201.png

我不明白我做错了什么。

0 个答案:

没有答案