Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6838071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:33:09+00:00 2026-05-26T23:33:09+00:00

I am building an app in which the users can have different roles (like

  • 0

I am building an app in which the users can have different roles (like seller, buyer, agency, etc). So my plan is use polymorphic association, build a class for each of the roles, and associate each instance with one user account. Each user can only be of one of those types, and after reading on the subject I concluded that this is better than using STI, but correct me if I am wrong.

So the app will have different sign up screens for the main types of user accounts. For instance, in the Seller sign up form, what will happen is that the user will fill in the details required for his user account and the fields specific for the Seller profile.

So this form should create the user object, and then the seller object associated to the former. How do you handle this? My guess is that this form should correspond to the ‘new’ action of the sellers controller, and in the create action the user account should be created before finally creating the seller.

Is this correct? If so, should I call the User controller create action from the Seller controller, or call directly the User model? If it’s the former please provide some example code, because I am not sure about how I should call one controller from another.

EDIT: I also considered using a multipart form, which is probably easier, but before deciding I want to check out this option.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:33:10+00:00Added an answer on May 26, 2026 at 11:33 pm

    If you’re bent on doing it this way, I’d say just call the model from the create method of the Seller controller. What type of relationship do you have between the User model and the Seller model? Because you’d need to do something like this:

    def create
        user = User.create(params[:user])
        seller = Seller.new(params[:seller])
        seller.user_id = user.id
        seller.save
        redirect_to #wherever
    end
    

    Here I just assumed you have a belongs_to :user in the Seller model. Still I would advise you to consider a gem like cancan or something to handle roles instead of this approach.

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app i building which is a simple naviagtion app. I do
Im building a web application which is a process management app. Several different employee
I´m building an asp.net app, which technology I should use to get AJAX capabilities?
I am building a web app in Silverlight which allows users to view and
I am building a Rails 3 app which renders different views for mobile devices
I am building an app that can use a user's current location on certain
I am building an app in which at some point I have to show
I'm building a web app where users can build custom web pages that pull
I am building a Facebook App which is heavy on Javascript. For this I
I am building an app for which I need to set up cron jobs.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.