0
每一个!我正在使用回形针上传文件回形针 - 如何访问保存的文件
class Model
include Mongoid::Document
include Mongoid::Paperclip
has_many :myfiles
end
class Myfile
include Mongoid::Document
include Mongoid::Paperclip
belongs_to :model
has_mongoid_attached_file :file,
:path => ":rails_root/public/uploads/:class/:id/:basename.:extension",
end
我的问题是如何访问保存后上传的文件?我想:
@model.myfiles.first.path
@model.myfiles.first.url
提示错误:
NoMethodError: undefined method `path' for #<Myfile:0x007fd22b336f80>
非常感谢您的帮助!
非常感谢您!有用! – 2014-10-28 16:16:10