我的应用程序的基本URL是什么? [英] What's the base URL for my app?

查看:703
本文介绍了我的应用程序的基本URL是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Camping/Rack中,如何获取应用程序的基本URL?我想知道,所以可以将其放入发送的电子邮件中.

In Camping/Rack, how can I get the base URL for my app? I want to know so I can put it in an email it sends.

可能是(开发中)

http://localhost:9292

http://localhost:80/game

或在生产中

http://fancy-snake.heroku.com

推荐答案

露营有一个名为

Camping has a helper called URL which returns the absolute URL to your app:

URL()               # => #<URL:http://test.ing/blog/>
URL() + "view/12"   # => #<URL:http://test.ing/blog/view/12>
URL("/view/12")     # => #<URL:http://test.ing/blog/view/12>

这篇关于我的应用程序的基本URL是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆