开发者

cannot generate routes

开发者 https://www.devze.com 2023-01-15 09:12 出处:网络
i have a problem as following. i 开发者_JAVA百科have a resources setup in my routes.rb file as following

i have a problem as following.

i 开发者_JAVA百科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


Have you tried adding those calls to the nested sub_transactions resource? Like:

resources :users do
  resources :sub_transactions do
    collection do 
      get :income
      get :expenditure
    end
  end
end

I'm not in a position to test at the moment but that would be the logical starting point (I figure).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号