How to get current absolute URL in Ruby on Rails

PHOTO EMBED

Tue Dec 31 2019 19:00:00 GMT+0000 (Coordinated Universal Time)

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

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

For Rails 3.2 or Rails 4+

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