1

我似乎无法弄清楚如何将这条特定的路线从 Rails 2 移植到 3:

map.resources :webservices, :new => { :push_data => :post, :reset_url => :post }

相关的馅饼在这里:http ://pastie.org/4022761

4

1 回答 1

0

好的,我明白你在做什么。
您需要像这样更新您的 routes.rb 文件:

resources :webservices do 
    post :push_data, :on => :new
    post :reset_url, :on => :new
end

我对我在一个名为 Notes 的项目中的模型做了这个,当我调用 rake 路由时,它给了我这个:

push_data_new_note POST   /notes/new/push_data(.:format)        notes#push_data
reset_url_new_note POST   /notes/new/reset_url(.:format)        notes#reset_url
new_note           GET    /notes/new(.:format)                  notes#new

这应该可以解决您遇到的路线问题。让我知道这对你有什么影响。

于 2012-06-14T14:34:56.623 回答