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

  • Home
  • SEARCH
  • 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 6532275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:58:50+00:00 2026-05-25T09:58:50+00:00

I am creating an application where I need to categorize one of my models.

  • 0

I am creating an application where I need to categorize one of my models. There are five categories and they will not change, at least not for now. The object can only have one category at once. My two ideas are:

  1. Create a whole table for adding the categories and add them in the migration file. I would then store the category id in the db for my object. Read about this causing problems with testing so I’m not sure. And, it seems a bit overkill.

  2. Add a constant hash in my model for hosting the categories. I would then store the int key in my object.

Is there any better way I have not thought about? Are there any plugins for creating enums in rails?

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-25T09:58:51+00:00Added an answer on May 25, 2026 at 9:58 am

    I have used this plugin https://github.com/adzap/active_enum some time ago and I think it works OK. You should definitely try it.

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

Sidebar

Related Questions

am creating one application for student. I need to show digital clock with remaining
I am creating one application for student. I need to set the different message
I am creating application in Winform which among other things will also need to
I am creating an application and I need to connect to a database. The
I am creating some application, facebook application and i need to ask you something.
I am creating a moderating application in which i need to fetch all the
I'm creating a native C# application and I need to do a simple thing:
I am creating a web application in Java in which I need to run
I am creating a Console Application, in that I need to Call a Method,
I'm creating a reporting application, and our customers are going to need to generate

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.