简体   繁体   English

在Rails项目中,我们将所有常量定义放在config / environment.rb中,将更多特定定义放在config / environments / development.rb中?

[英]In a Rails project, we put all constants definition in config/environment.rb and more particular ones in config/environments/development.rb?

Is that the usual convention? 这是通常的惯例吗? The more general constants in config/environment.rb , and more particular ones, such as HOST_NAME for development mode in config/environments/development.rb as localhost:3000 , in config/environments/production.rb as www.mygreatwebsite.com , and they will automatically get included into the project? config/environment.rb更一般的常量,以及更具体的常量,例如config/environments/development.rb开发模式的HOST_NAME as localhost:3000config/environments/production.rb中的www.mygreatwebsite.com ,他们会自动加入项目吗?

The config files test/production/development.rb are used when the rails application is started in one of these specific environments (test/production/development). 当rails应用程序在其中一个特定环境(测试/生产/开发)中启动时,将使用配置文件test / production / development.rb。 The config.rb is used to define configuration which applies to all environments. config.rb用于定义适用于所有环境的配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到config / environments / development.rb命令 - config/environments/development.rb command not found 我应该将Rails项目的常量放在environment.rb中吗? - Should I put constants for my Rails project in environment.rb? git pull说config / environments / development.rb未提交 - git pull says config/environments/development.rb is not committed 迁移 Rails 6.0.34 -&gt; 6.1 后,我无法在 config/environments/development.rb 中使用 model - After migration Rails 6.0.34 -> 6.1 I can't use model inside the config/environments/development.rb rails生成rspec:install config / environments / development.rb:1:在`<top(required)>':undefined method`configure' - rails generate rspec:install config/environments/development.rb:1:in `<top (required)>': undefined method `configure' Rails 3在config / environments / development.rb中从lib加载类的问题 - Rails 3 problem loading classes from lib in config/environments/development.rb config / environments / development.rb中“consideration_all_requests_local”的用途? - Purpose of “consider_all_requests_local” in config/environments/development.rb? 将变量添加到config / development.rb rails引擎 - Adding Variables to config/development.rb rails engine 在environment.rb中使用全局常量的Rails - Rails using global constants in environment.rb 配置下的environment.rb文件出错(Ruby on Rails) - Error on environment.rb file under config (Ruby on rails)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM