How do I get the current absolute URL in Ruby on Rails?
How can I get the current absolute URL in my Ruby on Rails view?The request.request_uri only returns the relative URL.
View ArticleAnswer by ghoppe for How do I get the current absolute URL in Ruby on Rails?
If by relative, you mean just without the domain, then look into request.domain.
View ArticleAnswer by Jaime Bellmyer for How do I get the current absolute URL in Ruby on...
For Rails 3.2 or Rails 4+You should use request.original_url to get the current URL. Source code on current repo found here.This method is documented at original_url method, but if you're curious, the...
View ArticleAnswer by James M for How do I get the current absolute URL in Ruby on Rails?
I think request.domain would work, but what if you're in a sub directory like blah.blah.com? Something like this could work:<%= request.env["HTTP_HOST"] + page = "/"+...
View ArticleAnswer by grosser for How do I get the current absolute URL in Ruby on Rails?
You can add this current_url method in the ApplicationController to return the current URL and allow merging in other parameters# https://x.com/y/1?page=1 # + current_url( :page => 3 )# =...
View ArticleAnswer by ecoologic for How do I get the current absolute URL in Ruby on Rails?
DEPRECATION WARNING: Using #request_uri is deprecated. Use fullpath instead.
View ArticleAnswer by mcr for How do I get the current absolute URL in Ruby on Rails?
I think that the Ruby on Rails 3.0 method is now request.fullpath.
View ArticleAnswer by Ken Earley for How do I get the current absolute URL in Ruby on Rails?
It looks like request_uri is deprecated in Ruby on Rails 3.Using #request_uri is deprecated. Use fullpath instead.
View ArticleAnswer by Lucas Renan for How do I get the current absolute URL in Ruby on...
In Ruby on Rails 3.1.0.rc4: request.fullpath
View ArticleAnswer by Duke for How do I get the current absolute URL in Ruby on Rails?
For Ruby on Rails 3:request.urlrequest.host_with_portI fired up a debugger session and queried the request object:request.public_methods
View ArticleAnswer by grzuy for How do I get the current absolute URL in Ruby on Rails?
You could use url_for(only_path: false)
View ArticleAnswer by Dorian for How do I get the current absolute URL in Ruby on Rails?
I needed the application URL but with the subdirectory. I used:root_url(:only_path => false)
View ArticleAnswer by Yuri Barbashov for How do I get the current absolute URL in Ruby on...
url_for(params)And you can easily add some new parameter:url_for(params.merge(:tag => "lol"))
View ArticleAnswer by Tim Santeford for How do I get the current absolute URL in Ruby on...
This works for Ruby on Rails 3.0 and should be supported by most versions of Ruby on Rails:request.env['REQUEST_URI']
View ArticleAnswer by msroot for How do I get the current absolute URL in Ruby on Rails?
(url_for(:only_path => false) == "/" )? root_url : url_for(:only_path => false)
View ArticleAnswer by Frans for How do I get the current absolute URL in Ruby on Rails?
None of the suggestions here in the thread helped me sadly, except the one where someone said he used the debugger to find what he looked for.I've created some custom error pages instead of the...
View ArticleAnswer by Sergiy Seletskyy for How do I get the current absolute URL in Ruby...
Using Ruby 1.9.3-p194 and Ruby on Rails 3.2.6:If request.fullpath doesn't work for you, try request.env["HTTP_REFERER"]Here's my story below.I got similar problem with detecting current URL (which is...
View ArticleAnswer by Ahmad hamza for How do I get the current absolute URL in Ruby on...
To get the absolute URL which means that the from the root it can be displayed like this <%= link_to 'Edit', edit_user_url(user) %>The users_url helper generates a URL that includes the protocol...
View ArticleAnswer by Victor S for How do I get the current absolute URL in Ruby on Rails?
if you want to be specific, meaning, you know the path you need: link_to current_path(@resource, :only_path => false), current_path(@resource)
View ArticleAnswer by mikrobi for How do I get the current absolute URL in Ruby on Rails?
In Rails 3 you can userequest.original_urlhttp://apidock.com/rails/v3.2.8/ActionDispatch/Request/original_url
View Article