Where can I store site-wide variables in Rails 4?

前端 未结 5 1119
眼角桃花
眼角桃花 2020-12-13 14:41

I am new to Rails and come from a ColdFusion background, where we would store global / site-wide variables in the \'application\' scope. This persists the variable across an

5条回答
  •  情歌与酒
    2020-12-13 15:16

    You can use gem figaro

    write your variables in config/application.yml

    HELLO: world
    development:
      HELLO: developers
    production:
      HELLO: users
    

    Then you can fetch

    ENV["HELLO"]
    

提交回复
热议问题