1

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? Shouldn't the code change to something like this?

resources :users do
  resources :account
end
Benoit Garret
  • 14,027
  • 4
  • 59
  • 64
castiel
  • 2,675
  • 5
  • 29
  • 38
  • 2
    For the plural "problem", change the `resources` from plural to singular: `resource :account`. As for the error, show us the URL / code that resulted in the error. – Zabba Sep 27 '11 at 14:55
  • thank you, mate. the "problem" is solved. But can you tell me is there any short cut to do some simple CRUDs with association model just like the scaffold did with a single model! – castiel Sep 27 '11 at 15:16

0 Answers0