Steve Castaneda wrote: > My routes are working, and in the console I can see user.account and > account.users just fine. I'm stuck at how I'm supposed to add the > creation on the new account in my user > create method.
There are a few ways you could accomplish this. One way would be to use nested routes. Make User nested under Account. That way you'll have access to the account when you need to add users to the account: POST: http://localhost:3000/accounts/1/users This could be used to add the users to the account later. For the case where you need to create a new Account and your first "admin" User. You could create both during the signup process in the accounts_countoller #create action: @account = Account.new(...account params...) @account.users.build(...user params...) @account.save Or something to that effect. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

