userden
userden

Reputation: 1683

How to display the current subdomain URL in a Rails view?

Using Rails 4 and Devise. How could I, in devise/sessions/new.html.erb, display the full current URL, e.g. http://(request.subdomain).example.com, in the view?

For example in new.html.erb:

<p>Please bookmark http://yoursubdomain.example.com</p>

Upvotes: 1

Views: 822

Answers (2)

Tom
Tom

Reputation: 520

<p>Please bookmark <%= "http://" + request.subdomain + ".example.com" %></p>

Hope this helps.

Upvotes: 0

Shamsul Haque
Shamsul Haque

Reputation: 2451

Try like that:-

request.original_url

In view as:-

<%= request.original_url %>

Upvotes: 3

Related Questions