Rails static model with multiple columns -


i reading using enums static models in rails, things statuses can candidate simple usage.

enum status: {active: 0, archived: 1} 

i above, try expand little. have static model have more columns, not sure how implement this.

let's have status static model, want tie in more properties each of status. e.g.:

active: {value: 0, rank: 3, description: "activated"} archived: {value: 1, rank: 2, description: "archived"} deleted: {value: 2, rank: 1, description: "removed"} 

all data still static , not change, there property binded.. how can use static model design pattern implement it?

its better have properties single column text datatype can store contents serialized hash. eg if having book model attributes book different editions means design properties column like

           :edition1:               noofpages: 400              price: 420$              isbn: ksn78n 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -