Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在编写一个个人时间管理系统,结果我需要存储配置数据,例如其他人注册 Web 应用程序的可用时间。然而,由于这个系统是专门为一个人的日程安排的,我认为我不需要使用 sql 数据库,因为它只会有一个条目。那么我在哪里可以存储这个配置呢?谢谢你。
你可以做这种事情,把它放在 config/environment.rb
AppName::Application.configure do config.key = value config.key2 = value2 end
在您的控制器中,您可以通过以下方式访问它
AppName::Application.config.key