Where is the best place to store application parameters : database, file, code…?

后端 未结 5 1623
礼貌的吻别
礼貌的吻别 2021-01-03 10:24

I am developing a Ruby on Rails website and I have an \"architectural\" question : my application needs some parameters and I\'m wondering where to store them.

In co

5条回答
  •  执笔经年
    2021-01-03 10:51

    I tend to just make a string column for each, and use validates_inclusion_of to set what's acceptable for them.

    class Request < ActiveRecord::Base
      validates_inclusion_of :validation_status, :in => ['accepted','rejected','waiting']
      validates_inclusion_of :sending_status, :in => ['sent','waiting','...']
    end
    

    If you need to have things happen (ie. emails sent) when the status changes, look into using the Acts As State Machine plugin to manage it.

提交回复
热议问题