Undefined method `original_filename' for nil:NilClass

Hi, although I saw this problem in other blogs, I couldn’t make it
works.
My view:
<%= semantic_form_for :routes_status_race, :url =>
status_race_admin_routes_path do |f| %>

  • <% contact_array = Contact.all.map {|contact| [contact.name,
    contact.id]}%>*
  • <% route_importer_array = RouteImporter.all.map {|importer|
    [importer.name, importer.id]}%>*
  • <%= f.inputs do%>*
  • <%= f.input :contact, :as => :select, :collection => Contact.all %>*
  • <%= f.input :route_import, :as => :select, :collection =>
    RouteImporter.all %>*
  •    <%= f.input :uploaded_data, :action => :status_race, :multipart 
    

=>
true, :as => :file %>*

  • <%end%>*
  • *
    <%end%>

My controller:

collection_action :status_race, :method => :post do
*
*

  • uploaded_io = params[:uploaded_data].original_filename*
  • File.open(Rails.root.join(‘app/importers’, ‘uploads’,
    uploaded_io.original_filename), ‘w’) do |file|*
  •  file.write(uploaded_io.read)*
    
  • end*
  • RoutesQuickcom.new.run(uploaded_io.original_filename)*
  • render “status_race”*
  • end*
    end

I don’t know how to fix it , any help will be appreciate, thanks!

Now is solved, just in case that somebody will has the same problem,
here
is the solution, the view was right, I just change the controller part:

collection_action :status_race, :method => :post do
*
*

  • uploaded_io = params[:routes_status_race][:uploaded_data]*
  • File.open(Rails.root.join(‘app/importers’, ‘uploads’,
    uploaded_io.original_filename), ‘w’) do |file|*
  •  file.write(uploaded_io.read)*
    
  • end*
  • RoutesQuickcom.new()*
  • render “status_race”*
  • end*