【问题标题】:Neo4J.rb & Carrierwave-neo4j — File upload errorNeo4J.rb & Carrierwave-neo4j — 文件上传错误
【发布时间】:2011-12-01 18:19:51
【问题描述】:

大约两周前,我尝试使用 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

我只更新了 gem,不处理我的应用程序的“上传部分”。 Neo4j 尝试使用多部分数据解析哈希时似乎出现错误......也许我错了?

【问题讨论】:

    标签: ruby-on-rails neo4j carrierwave


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-30
      • 2016-04-05
      • 1970-01-01
      • 2013-12-09
      • 2011-10-06
      • 2018-07-08
      相关资源
      最近更新 更多