我有多个 Rails 服务器实例,每个实例都需要知道 environment.rb 中自己的侦听端口。request.port 将在控制器中工作,但不能在 environment.rb 的上下文中工作。有办法吗?谢谢!
问问题
1038 次
1 回答
0
You can get the running rails port using this code:
Rails::Server.new.options[:Port]
You can take a look at the options parser in the Rails documentation to see what hash parameters are available.
于 2013-05-28T08:57:47.083 回答