Reputation: 235
I am trying to have a routing rule which does the below
http://localhost:3003/tab/show#user11
when this url is loaded, the system should fetch the value after # and use it to generate user output.
I tried to add this rule in the routes.rb file
match "tab/show#:value => "tab#show"
but i could not able to use this and fetch the value after # like
@current = request["value"]
Please suggest.
Upvotes: 0
Views: 49
Reputation: 411
If you change your root to
match "tab/show/:value => "tab#show"
and use the URL
http://localhost:3003/tab/show/user11
then it will be available in the params hash:
@current = params[:value]
Unless you have a good reason for your current structure then this is the best way to do it.
Tom
Upvotes: 1
Reputation: 15771
This part of url isn't being sent to the server during request. So, naturally, you can't get access to it on the server-side. Use javascript to access it.
And it's not Rails' "feature". It's common thing.
Upvotes: 2