Ask A Question


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


Hey Alan, check out this episode:

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. 👍


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

Join the discussion
Create an account Log in

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

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

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

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.