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
  • 28,875
  • 31
  • 150
  • 214

2 Answers2

2

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

Syed Aslam
  • 8,547
  • 5
  • 43
  • 53
1

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

Community
  • 1
  • 1