I am trying to create a Chef recipe for error handling, this recipe will be ran through Rundeck. If an error occurs throughout this run I want specific information to be logged including the Rundeck URL which the script is running on.
Is there such a way in Ruby to get the current URL?
Depends on which type of URL you want:
For Realtive URL : request.request_uri
For Absolute URL : request.original_url
Implementation :
def original_url
base_url + original_fullpath
end
If you are on rails 3 : request.fullpath
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With