Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do i create another table when a user signs up?

Alan Reid asked in Rails

When a user signs up, i ask them for their company name so i can then associate that user with a company. How would i go about doing this? I am using devise, so somehow i will need to store the company name in the company table.

Please help :D

Reply

Hey Alan, check out this episode: https://gorails.com/episodes/forum-nested-attributes-and-fields-for

Basically what you can do is setup a form that assigns attributes to two models at the same time. This will let you create a user and their associated Company record in a single form. 👍

Reply

Cheers Chris, Let me check this out and get it working :D

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.