uploading and import csv to rails
-
20-06-2021 - |
質問
i have followed this tut enter link description here, though i seem to have encountered a few issues. the problem i am getting is
NameError
undefined local variable or method `map' for #<ActionDispatch::Routing::Mapper:0x007f81b1bd0170>
which i believe is related to the routes.rb
map.resources :imports
map.import_proc '/import/proc/:id', :controller => "imports", :action => "proc_csv"
im using Ruby 1.9.3, Rails 3.2.3
解決
map
is the keyword used for routing in Rails 2. Rails 3 routing is substantially changed. You want something more like this:
resources :imports do
member do
get :import_proc
end
end
For more information, check out the Rails routing guide.
他のヒント
import_proc is a member method so you need to pass in a parameter
import_proc_path(id)
Member methods require a parameter, an ID Collection methods does not require a parameter so it doesn't require a parameter
所属していません StackOverflow