Get app url with rails

This is the root of my app:

http://localhost:3000/management

How can I get this from within rails?

eggie5 wrote:

This is the root of my app:

http://localhost:3000/management

How can I get this from within rails?

@request.relative_url_root

New question - do we need the @?


Phlip
http://www.oreilly.com/catalog/9780596510657/
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax

Hi,

@request is deprecated: http://www.rubyonrails.org/deprecation, Instead
use request.

Jean-Etienne

I wound up using this:

#{request.protocol}#{request.host_with_port}

but thanks for pointing me to the request class

[Please don’t top post as it makes the discussion more difficult to
follow.]

On Aug 27, 2007, at 16:58 , eggie5 wrote:

#{request.protocol}#{request.host_with_port}

Which you could write as

#{ request.protocol + request.host_with_port }

if you cared to. I have a feeling that a lot of people don’t realize
that #{} can contain an arbitrary expression rather than just a
variable name. In this case combining both in one #{} reduces the
noise a bit.

Michael G.
grzm seespotcode net

Yeah, I know about that, I was just in rush.
Thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs