0

在我的 rails 应用程序中,我有一个包含许多Enterprises.

在我的节目/节目中,我希望可以选择简单地创建一个Enterprise属于所示节目的新节目。

我尝试使用嵌套资源和路由助手new_program_enterprise_path,但它给了我No route matches "{:action=>"new", :controller=>"enterprises"}"错误。

这就是我routes.rb的:

resources :programs do
    resources :enterprises
end
4

1 回答 1

1

问题是您如何使用路由助手。new_program_enterprise_path应该Program在它的参数中使用这样的实例,new_program_enterprise_path(@program)这将导致看起来像这样的路径 /programs/:program_id/enterprises/new

于 2013-08-09T14:03:53.693 回答