开发者

Yet another routing error in Rails3.1 when I tried to nest the resource

This is my error:

No route matches {:controller=>"accounts", :format=>nil}

and this is the url:

users/1/accounts/new

this is code in the routes.rb file:

resources :users do
  resources :accounts
end

OK, now I'm still confused about associations in Rails. The code above always uses the pluralized model name, like :users, :accounts.

Now, what if the relationship between user and account is one-to-one? Should开发者_JAVA技巧n't the code change to something like this?

resources :users do
  resources :account
end
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜