开发者

cannot generate routes

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜