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!
on 2012-11-12 14:42
on 2012-11-12 15:33
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*
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.