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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:02:31+00:00 2026-05-18T22:02:31+00:00

I am building an inventory management application with four different user types: admin, employee,

  • 0

I am building an inventory management application with four different user types: admin, employee, manufacturer, transporter. I haven’t started coding yet, but this is what I’m thinking.. Manufacturers and transporters are related with has_many :through many-to-many association with products as follows:

class Manufacturer < ActiveRecord::Base
 has_many :products
 has_many :transporters, :through => :products
end

class Product < ActiveRecord::Base
 belongs_to :manufacturer
 belongs_to :transporter
end

class Transporter < ActiveRecord::Base
 has_many :products
 has_many :manufacturers, :through => :products
end

All four user types will be able to login, but they will have different permissions and views, etc. I don’t think I can put them in the same table (Users), however, because they will have different requirements, ie: vendors and manufacturers must have a billing address and contact info (through validations), but admins and employees should not have these fields.

If possible, I would like to have a single login screen as opposed to 4 different screens.

I’m not asking for the exact code to build this, but I’m having trouble determining the best way to make it happen. Any ideas would be greatly appreciated – thanks!

  • 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-18T22:02:31+00:00Added an answer on May 18, 2026 at 10:02 pm

    Your basic approach seems reasonable. I would advise you to make a base class of User and use STI for specific User types, for instance:

    class User < ActiveRecord::Base
    end
    
    class Manufacturer < User
     has_many :products
     has_many :transporters, :through => :products
    end
    

    …etc. This way if there’s ever the need to aggregate multiple user types into one relationship regardless of type, you have one table to describe Users in general. This is a fairly common approach.

    Depending on how much access different users will have to the system, you may want to look at a Role Management gem like Declarative Authorization.

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

Sidebar

Related Questions

Im building a web application which is a process management app. Several different employee
I'm trying to learn RoR, building my first app, a basic inventory application. I've
Building a client-side swing application what should be notified on a bus (application-wide message
Building the same project (without any changes) produces binary different exe-files: some small regions
Using SQL Server 2005. I am building an inventory/purchasing program and I’m at the
I'm building a Web Page that allows the user to pick a color and
I am building an inventory tracking system for internal use at my company. I
Building an application, before using a real database, just to get things work I
Im building my own forum where you can use diffrent types of BBcode and
When building an application and you are using a table that has a primary

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.