i am trying to insert into multiple tables using rails.. i have a table called users and services. when i create a user the user details should go into users and a service name and userid should go into services table. Any help would be greatly appriciated.
Thanks.
You can also use accept_nested_attributes_for:
Filling in the service_attributes hash is made simple with nested forms.
You can add a callback to create a new service when a user is created.
The after_create method is triggered after a new user creation. So a new service will be created every time you create a new user.
You can find more informations about the callbacks on the Rails Guides.