[Rails] 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%>
<input name='commit' type='submit' method='post' value='Import'/>
<%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!
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/zR8uF_jothkJ.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home