So Rails reads in the URL you pass into it and then decides what to do with it.
By convention, it will think that what you pass into it is
:controller/:id
So what it probably does is take in the url as a string, and breaks it down according to the /
character.
Try this in IRB.
controller, id = "hello/1".split("\/")
And then type in
id
Imagine that this newly set id
variable is passed into a params
hash like this:
params = {}
params[:id] = id
Now type in
params[:id]
The truth is way more complicated. I was looking through the source to try and find the specific method but there are just way too many things going on. Try checking out this in ActionDispatch
http://api.rubyonrails.org/classes/ActionDispatch/Routing.html
Good luck!