Redmine Importer problem

Added by Dan Bendt almost 8 years ago

Hello all-

I've been branching the Importer plugin "here": http://github.com/rchady/redmine_importer and have been having some trouble getting FasterCSV to work properly in my Linux production environment. It works properly in my local Windows development environment, but am continually getting this NoMethodError when running the plugin on Linux.

NoMethodError (undefined method `[]' for nil:NilClass):
    /vendor/plugins/mass_upload/app/controllers/importer_controller.rb:87:in `result'

And here is the source:

  def result
    tmpfilename = session[:importer_tmpfile]
    splitter = session[:importer_splitter]
    wrapper = session[:importer_wrapper]
    encoding = session[:importer_encoding]

    if tmpfilename
      tmpfile = $tmpfiles[tmpfilename] <-- line 87
      if tmpfile == nil
        flash[:error] = "Can't find file!" 
        return
      end
    end@

Here is the initialization of $tmpfiles in the match action if you're curious:
    file = params[:file]

    # save import file
    original_filename = file.original_filename
    tmpfile = Tempfile.new("mass_upload")
    #disbled in Unix environment
    tmpfile.binmode
    file.binmode

I've tried a bunch of different formats for the CSV file, using the binmode method, etc. and am really stumped here. Anyone have any ideas I could try here? Hopefully, its something simple I'm just missing.

Thanks in advance.

Replies (1)

RE: Redmine Importer problem - Added by iza zam almost 8 years ago

Hi,

Have you tried this. It works for me

Gary 说:
2009/10/02于13:43

I have a simple fix for error 500:
Go to the file redmine/vendor/plugins/redmine_importer/app/controllers/importer_controller.rb and change line 70 to the following:

@attrs.sort! {|x,y| x.to_s y.to_s }

The problem is that ruby doesn’t know how to sort symbols in an array, so the code above converts the symbols to strings so that they can be compared during the sort.

(1-1/1)