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

时间:2011-12-01 18:19:51

标签: ruby-on-rails neo4j carrierwave

大约两周前,我尝试使用Neo4J.rb和reu / carrierwave-neo4j在我的rails应用程序中提供文件上传。它运作正常。但现在它已经崩溃了。

当我填写文件字段时,出现错误:

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试图用多部分数据解析散列时似乎是错误的...也许我错了?

1 个答案:

答案 0 :(得分:0)