ネストされたリソースのフォームを読み込むときに、メソッドなしエラーが表示されます。私はそれのための修正がありますが、私は確信していません。奇妙なルーティングの問題 - メソッドエラーなし
私のroutes.rbをが含まれています
<%= semantic_form_for([@order, @technical]) do |f| %>
フォームをロードし、私はエラーを取得する:私のtechncials.html.erbフォームの上部に
resources :orders do
resources :comments, :technicals, :milestones
end
私はこれを持っている
> NoMethodError in Technicals#new
>
> undefined method `technicals_path' for
> #<#<Class:0x00000102118318>:0x000001020ec470>
これを私のルートに置くと、すべて正常に動作します。
resources :technicals, :only => [ :create ]
私は間違って何をしていますか?
編集:私は私のモデルなどを考えるが、すべて正しく設定されています
class Technical < ActiveRecord::Base
belongs_to :order
end
を - 編集 - コントローラー/ technicals_controller.rbは「DEF
company_order_comments GET /companies/:company_id/orders/:order_id/comments(.:format) {:action=>"index", :controller=>"comments"}
POST /companies/:company_id/orders/:order_id/comments(.:format) {:action=>"create", :controller=>"comments"}
new_company_order_comment GET /companies/:company_id/orders/:order_id/comments/new(.:format) {:action=>"new", :controller=>"comments"}
edit_company_order_comment GET /companies/:company_id/orders/:order_id/comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
company_order_comment GET /companies/:company_id/orders/:order_id/comments/:id(.:format) {:action=>"show", :controller=>"comments"}
PUT /companies/:company_id/orders/:order_id/comments/:id(.:format) {:action=>"update", :controller=>"comments"}
DELETE /companies/:company_id/orders/:order_id/comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
company_orders GET /companies/:company_id/orders(.:format) {:action=>"index", :controller=>"orders"}
POST /companies/:company_id/orders(.:format) {:action=>"create", :controller=>"orders"}
new_company_order GET /companies/:company_id/orders/new(.:format) {:action=>"new", :controller=>"orders"}
edit_company_order GET /companies/:company_id/orders/:id/edit(.:format) {:action=>"edit", :controller=>"orders"}
company_order GET /companies/:company_id/orders/:id(.:format) {:action=>"show", :controller=>"orders"}
PUT /companies/:company_id/orders/:id(.:format) {:action=>"update", :controller=>"orders"}
DELETE /companies/:company_id/orders/:id(.:format) {:action=>"destroy", :controller=>"orders"}
companies GET /companies(.:format) {:action=>"index", :controller=>"companies"}
POST /companies(.:format) {:action=>"create", :controller=>"companies"}
new_company GET /companies/new(.:format) {:action=>"new", :controller=>"companies"}
edit_company GET /companies/:id/edit(.:format) {:action=>"edit", :controller=>"companies"}
company GET /companies/:id(.:format) {:action=>"show", :controller=>"companies"}
PUT /companies/:id(.:format) {:action=>"update", :controller=>"companies"}
DELETE /companies/:id(.:format) {:action=>"destroy", :controller=>"companies"}
order_comments GET /orders/:order_id/comments(.:format) {:action=>"index", :controller=>"comments"}
POST /orders/:order_id/comments(.:format) {:action=>"create", :controller=>"comments"}
new_order_comment GET /orders/:order_id/comments/new(.:format) {:action=>"new", :controller=>"comments"}
edit_order_comment GET /orders/:order_id/comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
order_comment GET /orders/:order_id/comments/:id(.:format) {:action=>"show", :controller=>"comments"}
PUT /orders/:order_id/comments/:id(.:format) {:action=>"update", :controller=>"comments"}
DELETE /orders/:order_id/comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
order_technicals GET /orders/:order_id/technicals(.:format) {:action=>"index", :controller=>"technicals"}
POST /orders/:order_id/technicals(.:format) {:action=>"create", :controller=>"technicals"}
new_order_technical GET /orders/:order_id/technicals/new(.:format) {:action=>"new", :controller=>"technicals"}
edit_order_technical GET /orders/:order_id/technicals/:id/edit(.:format) {:action=>"edit", :controller=>"technicals"}
order_technical GET /orders/:order_id/technicals/:id(.:format) {:action=>"show", :controller=>"technicals"}
PUT /orders/:order_id/technicals/:id(.:format) {:action=>"update", :controller=>"technicals"}
DELETE /orders/:order_id/technicals/:id(.:format) {:action=>"destroy", :controller=>"technicals"}
order_milestones GET /orders/:order_id/milestones(.:format) {:action=>"index", :controller=>"milestones"}
POST /orders/:order_id/milestones(.:format) {:action=>"create", :controller=>"milestones"}
new_order_milestone GET /orders/:order_id/milestones/new(.:format) {:action=>"new", :controller=>"milestones"}
edit_order_milestone GET /orders/:order_id/milestones/:id/edit(.:format) {:action=>"edit", :controller=>"milestones"}
order_milestone GET /orders/:order_id/milestones/:id(.:format) {:action=>"show", :controller=>"milestones"}
PUT /orders/:order_id/milestones/:id(.:format) {:action=>"update", :controller=>"milestones"}
DELETE /orders/:order_id/milestones/:id(.:format) {:action=>"destroy", :controller=>"milestones"}
orders GET /orders(.:format) {:action=>"index", :controller=>"orders"}
POST /orders(.:format) {:action=>"create", :controller=>"orders"}
new_order GET /orders/new(.:format) {:action=>"new", :controller=>"orders"}
edit_order GET /orders/:id/edit(.:format) {:action=>"edit", :controller=>"orders"}
order GET /orders/:id(.:format) {:action=>"show", :controller=>"orders"}
PUT /orders/:id(.:format) {:action=>"update", :controller=>"orders"}
DELETE /orders/:id(.:format) {:action=>"destroy", :controller=>"orders"}
/orders(.:format) {:controller=>"orders", :action=>"index"}
root /(.:format) {:controller=>"home", :action=>"index"}
rakeルートの出力に追加できますか? – jaydel
確かに問題があれば編集しますJ –
ありがとう:)素早く、必要なパス名がnew_order_technical_pathのように見えます。私はこの結論に飛びついています。なぜなら、これらの_pathメソッドは、左端の列を取得し、それらに_pathを追加することによって生成されると信じているからです。 – jaydel