无法生成路由
我有一个问题如下。
我的routes.rb 文件中有一个资源设置,如下所示
resources :users do
resources :sub_transactions
end
resources :sub_transactions do
collection do
get :income
get :expenditure
end
end
现在我应该编写的正确路线是什么,以便我可以生成以下路线,
users/1/sub_transactions/income
users/1/sub_transactions/expenditure
其中收入和支出不是ID
i have a problem as following.
i have a resources setup in my routes.rb file as following
resources :users do
resources :sub_transactions
end
resources :sub_transactions do
collection do
get :income
get :expenditure
end
end
Now what is the correct route that i should write so that i can generate the following routes
users/1/sub_transactions/income
users/1/sub_transactions/expenditure
where income and expenditure are not ids
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试过将这些调用添加到嵌套的 sub_transactions 资源?就像:
我目前无法进行测试,但这将是逻辑起点(我认为)。
Have you tried adding those calls to the nested sub_transactions resource? Like:
I'm not in a position to test at the moment but that would be the logical starting point (I figure).