Neo4J.rb & Carrierwave-neo4j — 文件上传错误



大约两周前,我尝试用Neo4J在rails应用程序中提供文件上传。Rb和reu/载波-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 view代码:

    <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

我只更新了gems,并没有在我的应用程序的"上传部分"工作。这似乎是错误的,而Neo4j试图用多部分数据解析哈希…也许我错了?

neo4j的版本。你在用什么?这可能是一个已经修复的bug。看看这个http://groups.google.com/group/neo4jrb/browse_thread/thread/a1fa5f675491da68问题是http://neo4j.lighthouseapp.com/projects/15548-neo4j/tickets/201-neo4jcarrierwave-neo4j-file-upload-error

相关内容

最新更新