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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T05:48:54+00:00 2026-06-03T05:48:54+00:00

When I have only two statuses for an object, like ‘active’ and ‘retired’ for

  • 0

When I have only two statuses for an object, like ‘active’ and ‘retired’ for employee, I’d have a boolean field in the table users to account the user’s status.

But what should I do if I have an object with three or more statuses? A task may be ‘new’, ‘in progress’, ‘finished’ and ‘closed’, and a computer may be ‘ordered’, ‘in store’, ‘in use’, ‘in repair’ and finally ‘disposed’.

I can see several options:

1) Additional table ‘statuses’. Status belongs to task, task have one status. It looks ok for me, but it takes additional table.

2) Somehow have a list of statuses in the ‘users’ table. Don’t know if it’s possible. I’m using PostgreSQL.

3) Decide that 1 means ‘new’, 2 – ‘in progress’, 3 – ‘finished’ and use these numbers as stauses.

4) Use name of status as a status. Make the field ‘status’ a string.

What is the best Rails way?

  • 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-06-03T05:48:55+00:00Added an answer on June 3, 2026 at 5:48 am

    I personally prefer the gems like state_machine or aasm where I have to create the string column for current state. So I think thats the right way because It gives me the information about the status right away.

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

Sidebar

Related Questions

I have simple form like this which accepts only two values string action and
I have a SQL table with only two columns: nameid and name. I want
I have two tables, users and hra. A user can only have one record
I have two cursors in my procedure that only differ on the table name
I have two models that I would like to save in the same table.
I am creating an iPad, I would like to have only two orientations: lanscape
I have found only two methods (SaveFile, LoadFile) which save in a file. How
I am setting up a simple test page in Python. I only have two
I have two sites with different SITE_IDs, but I want to have only one
I have created tab style interface using css and javascript with only two tabs

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.