0 points

How to get current absolute URL in Ruby on Rails


dashboard

Tue Dec 31 2019 19:00:00 GMT+0000 (UTC)

Posted by @vasquezthefez #howto #rubyonrails #webdev #interviewquestions

# get "/articles?page=2"
request.original_url # => "http://www.example.com/articles?page=2"
content_copy Copy

For Rails 3.2 or Rails 4+

https://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-original_url