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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:55:01+00:00 2026-05-18T21:55:01+00:00

I have a project with several models like students,workers,administrators…. Of course those get different

  • 0

I have a project with several models like students,workers,administrators….
Of course those get different rights on the site.So I was wondering:

Should I log them from different views? so that each one of those views with its forms would handle one (known) model at the time or it would be equally easy to make the three of them in one?.

I tried to make one view but the first problem I had is recognizing which type of user was logging in,therefore it was a problem to know what view should I show next…

  • 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-18T21:55:01+00:00Added an answer on May 18, 2026 at 9:55 pm

    One of the fundamental philosophies behind Rails is DRY–Don’t Repeat Yourself. Following this philosophy, it seems rather redundant to have three separate login screens.

    In the same vein, having students, workers and administrators in separate models seem a bit unpractical. All users will (presumably) have names, emails and passwords–as well as other information. I would only have one model, and call that model what it is–User. Then, I can set up user groups like this:

    class User < ActiveRecord::Base
      belongs_to :user_group
    end
    
    class UserGroup < ActiveRecord::Base
      has_many :users
    end
    
    User.first.user_group # => <UserGroup name: 'Students'>
    User.find(123).user_group # => <UserGroup name: 'Workers'>
    UserGroup.find_by_name('Administrators').users # => [<User ...>, <User ...>, ...]
    

    Suddenly, login is no longer a problem. A user is authenticated as a user, and the application will immediately know what user group they belong to, and can display the appropriate information that way.

    Also, I’d be amiss if I didn’t give a shout-out to Devise. It’s a gem for handling authentication, and would definitely spare you a lot of work and effort if you’re thinking of creating the authentication methods by yourself.

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

Sidebar

Related Questions

I have a project that has components in several different directories and would like
Let's say i have several different models in django project. Now i need to
I have a project with several CSS files, each with many different settings. Every
I have a django project with 2 apps like this: ## tags app, models.py
I have an existing Django project that has several models using concrete inheritance of
I've got a situation where I have a project with several models that have
In my project, I have several models that use a number of scopes that
I have maven project with several modules. Need to deploy all modules( jars and
We have a mavenized project with several containers (wso2esb, wso2dss, tomcat) and many components
We have an ADP project created several years ago using Access 2000. This project

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.