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.
我正在开发一个 Rails 应用程序。我只想在服务器启动期间执行一段代码。我在哪里添加此代码?
在config/initializers. 该目录中的所有.rb文件只会在服务器启动时运行。
config/initializers
.rb