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
精彩评论