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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:37:23+00:00 2026-05-27T08:37:23+00:00

The application is written in Ruby on Rails but the problem I am facing

  • 0

The application is written in Ruby on Rails but the problem I am facing is more a design matter than language related.

the system provides service to a number of users to maintain a registry. So it relates persons to things. As such it has a model called Person representing owners and it has a model called User representing those who manage the registry.

Now a new requirement has arisen to allow People to log in and be able to change personal details which it was not required for the original design.

The question is how to refactor the application to allow this new requirement in?

One easy solution is to create Users for each person who request login credentials and link user to person entity but that is not very DRY as some fields such as firstname, surname etc. are in both classes and in particular, that is precisely the data people will be able to change. Besides User and Person are stored in separate tables.

The other possibility I was considering is to make one to extend the other but having data in separated tables it makes it a bit messy. Additionally the logical extension would be User <- Person as an user is (generally) a person but thinking on the implementation Person <- User is quite a lot easier.

One last option could be to scrap User and move login credentials into Person leaving logon fields empty for those who won’t log in and half of the fields empty for those just login in.

Can you think of a better solution?

  • 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-27T08:37:24+00:00Added an answer on May 27, 2026 at 8:37 am

    You could think about how this should ideally work if you were to write the application bottom-up, and then figure out how to make a reasonable compromise between that and your current setup. Here are some generic inputs.

    As authentication is involved, you need an “Identity” that can be authenticated. This can be e.g. an email address and an associated password, with email verification.

    An Identity can potentially be associated to multiple “Roles” and someone authenticated with the identity can choose which role to perform, e.g. “I am now an administrator” vs. “I am now a regular site user”, and the role defines the user’s current rights for the logged in identity. Or if you don’t need that level of complexity, you can say that an Identity is a (single) Role.

    You need some tracking between possible “Rights” and the Role the user is performing. E.g. the simplest setup could be the Identity or Role has some boolean can_edit_profile or can_modify_registry properties.

    Whenever a user attempts to perform an action which requires certain Rights, it is simply a matter of looking up the corresponding rights set for the Role being performed by the user, to check whether the user is allowed to proceed.

    For your application this may just involve adding a ‘can_change_registry’ property for your user objects, and check whether that property is True for any code accessing that part of the site.

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

Sidebar

Related Questions

Imagine a web application written in Ruby on Rails. Part of the state of
I have a twitter like web application written in Ruby on Rails that allows
I have a simple point of sale application written in ruby and rails, and
Does Webrat require that the web application be written in Ruby/Rails? I'd like to
This is the mysql code written for ruby on rails application Model.find_by_sql([SELECT * FROM
I'm porting desktop application to www with ruby on rails. Desktop application is written
I am looking for a backend solution for an application written in Ruby on
I have written a Ruby application which parses lots of data from sources in
I have created a blog application using Ruby on Rails and have just added
As part of my Rails application, I've written a little importer that sucks in

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.