expertiza/expertiza — Issue #181: Rails error when import file not specified
Author: efg
Created: 2012-01-22 02:42:22+00:00
State: open

If one attempts to import users or participants, and does not specify the file to import from, the following error occurs:

NoMethodError in Import fileController#import

undefined method `each_line' for nil:NilClass

RAILS_ROOT: /local/rails/expertiza/releases/20111212052140
Application Trace | Framework Trace | Full Trace

/local/rails/expertiza/releases/20111212052140/app/controllers/import_file_controller.rb:29:in `importFile' /local/rails/expertiza/releases/20111212052140/app/controllers/import_file_
controller.rb:11:in `import'
/local/rails/expertiza/shared/bundle/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `send'
/local/rails/expertiza/shared/bundle/ruby/1.8/gems/actionpack-2.3.14/lib/action_controller/base.rb:1333:in `perform_action_without_filters'

Solving it should be simply a matter of adding appropriate error-checking before line 29.

Mike Roda makes the following comment about where it is called from:

"Since it was the import_file_controller, a reasonable guess is the method was called by the view under app/views/import_file. There is only one view in there, start.html.erb. If you look in there you will see the form with an action to call the import method on the controller."