这是我的回形针启动器:
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
我不明白我做错了什么。