我不知道是什么原因,我的应用没有响应任何POST请求,这是一个非REST的URL。路由不工作
下面是我的routes.rb文件。
constraints(Subdomain) do
resources :invitations
resources :settings, :only => [:index, :create, :destroy]
scope "/settings" do
get "/departments" => "settings#departments"
get "/job_types" => "settings#job_types"
get "/industries" => "settings#industries"
get "/functional_areas" => "settings#functional_areas"
get "/managers" => "settings#managers"
get "/hrs_responsible" => "settings#hrs_responsible"
get "/welcome_text" => "settings#welcome_text"
post "/save_welcome_text" => "settings#save_welcome_text" <-------
end
end
我认为文件中,我有
=form_for(@setting), :url => "/settings/save_welcome_text", :method => :post do |f|
- All the form fields here.
- f.submit "Save"
这个要点包含生成的HTML,以及相应的服务器日志。 https://gist.github.com/943984
当我点击提交时,我看到“路由错误”,没有这样的路由存在。从服务器日志中,我可以嗅探到请求是作为POST请求发送的。 但是,如果我将它从routes.rb文件中的“post”更改为“匹配”,则可以使用。所有GET请求都正常工作。 我错过了什么吗?
你觉得为什么不工作呢?显示你如何试图称呼它。显示你的链接 – fl00r 2011-04-27 08:57:03
那么,我有一个“form_for(@setting),:url =>”/ settings/save_welcome_text“,:method =>:post”,它会抛出一个错误,表示没有路由存在。 – Deepak 2011-04-27 09:07:57
看看源代码并告诉我“