2011-12-01 43 views
0

大约两周前,我尝试使用Neo4J.rb和reu/carrierwave-neo4j在我的rails应用程序中提供文件上传。它工作正常。但现在它坠毁了。Neo4J.rb&Carrierwave-neo4j - 文件上传错误

当我填写文件中的字段都出现了错误:

java.lang.IllegalArgumentException: Unknown property type on: #ActionDispatch::Http::UploadedFile:0x17003a2, class org.jruby.RubyObject 

app/controllers/q_resources_controller.rb:47:in create' 
app/controllers/q_resources_controller.rb:45:increate' 

_form视图代码:

我控制器
<div class="field"> 
     <%= image_tag(@q_resource.bfile_url) if @q_resource.bfile? %> 
     <%= f.hidden_field :bfile_cache %> 
     <%= f.file_field :bfile %> 
     <label> 
     <%= f.check_box :remove_bfile %> 
     Remove bfile 
     </label> 
    </div> 

代码是:

45: Neo4j::Transaction.run do 
46: @q_resource = QResource.new(params[:q_resource]) 
47: @q_resource.save! 

但是我试着手动上传文件并取得成功(如果不填写文件字段):

Neo4j::Transaction.run do 
@q_resource = QResource.new() 
@q_resource.bfile = File.open("D:/Kirill.jpg") 
@q_resource.save! 

QResource模式是:

class QResource < Neo4j::Rails::Model 
property :title, :type => String 
index :title, :type => :fulltext 

property :description, :type => String 
index :description, :type => :fulltext 

property :body, :type => String 
index :body, :type => :fulltext 

property :position, :type => Fixnum 
index :position 

property :url, :type => String 
index :url 

property :note, :type => String 
index :note, :type => :fulltext 

property :isource, :type => String 
index :isource, :type => :fulltext 

property :created_at, :type => DateTime 
index :created_at 

property :updated_at, :type => DateTime 
index :updated_at 

property :bfile, :type => String 
mount_uploader :bfile, BinfileUploader 
end 

我只更新宝石也不要在我的应用程序“上传部分”工作。 Neo4j试图用多部分数据解析散列似乎是错误的......也许我错了?

回答