[英]uploading and import csv to rails
i have followed this tut enter link description here , though i seem to have encountered a few issues. 我跟着这个tut 在这里输入链接描述 ,虽然我似乎遇到了一些问题。 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 我认为这与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 即时通讯使用Ruby 1.9.3,Rails 3.2.3
map
is the keyword used for routing in Rails 2. Rails 3 routing is substantially changed. map
是用于在Rails 2中路由的关键字.Rails 3路由实质上已更改。 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 . 有关更多信息,请查看Rails路由指南 。
import_proc is a member method so you need to pass in a parameter import_proc是一个成员方法,因此您需要传入一个参数
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 成员方法需要一个参数,一个ID Collection方法不需要参数,所以它不需要参数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.