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 3977842
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:58:19+00:00 2026-05-20T04:58:19+00:00

I have a base table called users which holds all common information about a

  • 0

I have a base table called users which holds all common information about a user such as name, address, phone number…etc

I have another table called clients which holds specific information about a client (such as the client’s company name and their url) and inherits user information from the users table. A client has a foreign key user_id which maps back to the information about a user.

I have another table called client_admins which hold specific information about client_admins and also has a user_id field AND a client_id field (which links to the clients table).

I have another table called super_admins which links to the users table and has specific information about a Super admin.

I know I could probably get away with Single Table Inheritance as there is not a lot of different data between each of the types, just different functionality and privileges.

What is the best way to model this in Rails 3?

  • 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-20T04:58:19+00:00Added an answer on May 20, 2026 at 4:58 am

    Inside your user model:

    has_one :client
    has_one :client_admin
    has_one :super_admin
    

    Inside your client model:

    belongs_to :user
    has_one :client_admin
    

    Inside your client_admin model:

    belongs_to :user
    belongs_to :client
    

    Inside your super_admin model:

    belongs_to :user
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a table in MySQL which represents a base class, and I
I have a model called Notifications, which basically acts as a join table between
I have a base class object array into which I have typecasted many different
I have a base class with a property which (the get method) I want
I have a model called User . I have pluralize_table_names set to false so
Lets say there is a activerecord class called user, which is representative of user
I have a star schema type data base, with fact tables that have many
I have a base URL : http://my.server.com/folder/directory/sample And a relative one : ../../other/path How
I have a base class with an optional virtual function class Base { virtual
I have a base page, BasePage, that raises an event that displays messages to

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.