2
我无法将用户重定向到我想创建新的“服务”资源后所需的页面。Rails 3嵌套资源路由错误
这里的routes.rb中:
resources :wsps do
resources :services
end
HTML表单:
<%= form_for([@wsp,@service]) do |f| %>
Services_controller.rb:
def new
@wsp = current_wsp
@service = @wsp.services.build
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @service }
end
end
def create
@wsp = current_wsp
@service = @wsp.services.build(params[:service])
if @service.save
redirect_to wsp_service_path
end
end
的wsp_service_path进入/ WSPS/1 /服务错误:
No route matches {:action=>"destroy", :controller=>"services"}
我在做什么错了?为什么我不能使用“wsp_service_path”?
谢谢。