0

I read the two posts here and here, but still have trouble figuring out how everything is tied together. Basically I have 2 types of users, Trainers and Clients. They share some common attributes (email, phone, first name, last name, etc), but they will also have some custom attributes.

Assuming STI is the way to go, I would have 3 models:

  • User (devise)
  • Trainer (inherits from User)
  • Client (inherits from User)

When the user signs up, they should be able to use the same form and just select from a drop down if they're a trainer or client. Once the form is submitted how do I go about specifying the type of user that has just been created? Do I need logic in the controller to check the user type, and then run Trainer.create() or Client.create()?

Community
  • 1
  • 1
Dan Ramos
  • 1,092
  • 2
  • 19
  • 35

0 Answers0