我正在使用这个上传文件示例。
我正在尝试修改附加文件的:url。它无法以某种方式工作。我在终端中收到此错误:
NoMethodError (undefined method `upload_file_size' for #<Paperclip::Attachment:0x8ca35e8>):
我的上传.rb:
class Upload < ActiveRecord::Base
attr_accessible :upload, :upload_file_name, :upload_file_size
Paperclip::interpolates :upload_file_size do |attachment, style|
attachment.instance.upload_file_size
end
has_attached_file :upload,
:url =>"/system/Files/CEL-Files/:upload_file_size/:basename.:extension",
:path =>":rails_root/public/system/Files/CEL-Files/:piks/:basename.:extension"
include Rails.application.routes.url_helpers
这是我的 schema.rb:
ActiveRecord::Schema.define(:version => 20120731045929) do
create_table "uploads", :force => true do |t|
t.string "upload_file_name"
t.string "upload_content_type"
t.string "user"
t.integer "upload_file_size"
t.datetime "upload_updated_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end
提前致谢