With rails I can use this: request.original_url
in order to get this: http://localhost:3000/
But if I click on a tab https://localhost:3000#tab1 how I can get the current full URL along with the tab??
With rails I can use this: request.original_url
in order to get this: http://localhost:3000/
But if I click on a tab https://localhost:3000#tab1 how I can get the current full URL along with the tab??
You can't do it with Rails. Because the anchor is not sent to the server side.
In Rails you can only get URL with params.
But you can do it using JS: window.location
As others have mentioned, it's not possible simply because browsers will never send the hash property (it was originally used simply for jumping to different sections of the page).
Anyway, using hash in this way is a long-deprecated pattern. Instead, use the History API to change the path from JavaScript. Then the server will also be able to process such URLs. In Rails, there is the TurboLinks framework available to build your web app around this pattern.