0

My app will only have three instances of the model Category - "Published", "Draft", "Unpublished".

Instinctively it feels redundant to create a table for this.

I'm thinking of storing the three category titles in a Constant instead, but I don't know where the best place is to put the Constant such that it can be referenced by multiple models.

Is there any better solution to this, or am I overthinking the issue all together (i.e. should I just create a "normal" model class/table)?

Fellow Stranger
  • 32,129
  • 35
  • 168
  • 232

2 Answers2

2

An initializer file would be best suited to define those constants. Better yet, use configatron.

Syed Aslam
  • 8,707
  • 5
  • 40
  • 54
1

You need an enum. But Ruby doesn't have enums - so see this instead - Enums in Ruby

Community
  • 1
  • 1