在我的开发环境中,我能够成功地使用回形针创建下载。在生产中,将创建下载,但下载链接不起作用。
在开发中创建的链接:
http://localhost:3000/downloads/files/3?1345315475
在生产中创建的链接:
http://www.domain.com/attachments/original/missing.png
以下是创建下载时来自生产的日志:
Started POST "/downloads" for xxx.xxx.xxx.xxx at 2012-08-18 11:47:31 -0700
Processing by DownloadsController#create as JS
Parameters: {"utf8"=>"✓", "authenticity_token"=>"JhFMcjaui8cb4HCxTiIOjb/R2uxVJcOv3WEz8V0yoPp=", "download"=>{"school_id"=>"1", "software"=>"Follett", "original"=>"1", "makeup"=>"0", "visible"=>"1", "expired"=>"0"}, "commit"=>"Create Download"}
[paperclip] Saving attachments.
Rendered download_notice_mailer/download_notice.html.erb (1.9ms)
当我在控制台中搜索下载时(生产)
irb(main):001:0> d = Download.last
Download Load (0.4ms) SELECT `downloads`.* FROM `downloads` ORDER BY `downloads`.`id` DESC LIMIT 1
=> #<Download id: 8, visible: true, expired: false, software: "Skyward", created_at: "2012-08-18 19:01:35", updated_at: "2012-08-18 19:01:35", school_name: "SCHOOL NAME", original: true, makeup: false, attachment_file_name: nil, attachment_content_type: nil, attachment_file_size: nil, attachment_updated_at: nil, school_id: 8, district_id: 2>
您会注意到所有附件属性都为零。
我正在使用 rails 3.2.8 和回形针 3.1.4
我的 download.rb 模型文件的一部分
has_attached_file :attachment, :path => (Rails.root + "downloads/files/:id").to_s,
:url => "/downloads/files/:id"
validates_attachment_presence :attachment
attr_accessible :visible, :expired, :software, :school_name, :original, :makeup, :attachment, :school_id, :district_id
如果需要任何其他信息,请告诉我。
谢谢,