我们的主机不允许我们修改乘客配置文件(即apache配置或vhosts文件),但是我们想在开发模式下运行rails。因此,当应用程序重新启动时,我们必须在rails加载的文件之一中指定环境(prod/dev/test)。有人知道怎么做吗?
我们已经尝试了以下方法,但是没有运气:
#environment.rb (before any other code is executed)
`RAILS_ENV=development` # using back ticks
ENV['RAILS_ENV'] = 'development' # assigning to a constant
RAILS_ENV='development' # as suggested by one of the answers, unfortunately does not work.
最佳答案
为什么不更改您的production.rb配置以匹配development.rb中的设置?
关于ruby-on-rails - 如何从environment.rb或初始化程序中强制RAILS_ENV = development?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1915833/