简体   繁体   English

Rails 3路由

[英]Rails 3 routing

resources :users do
  get :save_delete, :on => :member
  get :question_form, :on => :member
  post :question_send, :on => :member
  resources :comments
end

After send and POST to my server I got this error in the log: 发送并POST到服务器后,我在日志中收到此错误:

#Started POST "/users/1/question_send"
#ActionController::RoutingError (No route matches "/users/1/question_send")

rake routes # works fine, no errors

You most likely haven't restarted your server. 您很可能尚未重新启动服务器。 The routing code looks fine. 路由代码看起来不错。

However, I agree with @mathepic - your resource seems rather odd. 但是,我同意@mathepic-您的资源似乎很奇怪。 There may be something we don't know, but unless you have a really really really good reason for these question_form and question_send member routes, you should probably think about doing this some other (and more Rails-y) way. 也许有些事情我们不知道,但是除非您真的有很好的理由来考虑使用question_formquestion_send成员路由,否则您可能应该考虑采用其他(以及更多Rails-y)方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM