0

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

Thilo
  • 17,565
  • 5
  • 68
  • 84
Boss Nass
  • 3,384
  • 9
  • 48
  • 90

2 Answers2

1

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.

Veraticus
  • 15,944
  • 3
  • 41
  • 45
  • that seems to have partly fixed it though now its doing this `ActionView::Template::Error (undefined method `import_proc_path' for #<#:0x007ff300112ad8>): 8: 9: <% else %> 10: 11: <%= link_to "process", import_proc_path(@import.id) %> 12: 13: <% end %> app/views/imports/show.html.erb:11:in `_app_views_imports_show_html_erb__3330178857390528579_70340796055700' – Boss Nass Jul 10 '12 at 15:22
  • how do i add the action of proc_csv to what you did ? – Boss Nass Jul 10 '12 at 15:54
1

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

YaBoyQuy
  • 783
  • 5
  • 8