我需要帮助来设置回形针与vestal_versions。我遵循了本教程
http://blog.dmfranc.com/post/1036667709/paperclip-and-vestal-versions但是当我尝试上传文件时,我得到了这个错误
回形针保存附件。在626ms内完成了500个内部服务器错误
NoMethodError (#的未定义方法` `version‘):
我的文件模型是来自building and building has_menu building_pdf的belongs_to。
class BuildingPdf < ActiveRecord::Base
belongs_to :building
has_attached_file :pdf, :keep_old_files => true, :url => "/pdf/:id/versions/:version/:basename.:extension",
:path => ":rails_root/system/pdf/:id/:version/:basename.:extension"
Paperclip.interpolates :version do |attachment, style|
attachment.instance.version.to_s
end
end这是我的/lib/initializers/versioning_with_paperclip.rb
module Paperclip
class Attachment
def save
flush_deletes unless @options[:keep_old_files]
flush_writes
@dirty = false
true
end
end
end我还错过了什么?
谢谢。
PS。在我的模型中添加了版本控制后,我得到了这个错误
[paperclip] Saving attachments.
Completed 500 Internal Server Error in 1512ms
Mysql2::Error (Table 'db.versions' doesn't exist):
app/models/building_pdf.rb:10:in `version'
config/initializers/versioning_with_paperclip.rb:5:in `save'发布于 2011-08-30 23:31:15
您需要将(版本化)添加到模型
class BuildingPdf < ActiveRecord::Base
versioned
..
endhttps://stackoverflow.com/questions/7245524
复制相似问题