user1899082
user1899082

Reputation:

Attaching parameters to the URL of a Rails route

This is a silly question but weird enough I Googled it, I am sure i had seen it before in Rails guides but now couldn't find it.

I want to attach parameters to my URL.

My initial url is this: "http://localhost:3000/pharmacy/patients"

Now I attach one URL with string concatination in JavaScript and it will be this:

"http://localhost:3000/pharmacy/patients?provider=234"

And still good.

Now I want to attach a second parameter named thera_class and its values are strings with spaces between them like "Nasal Congestion"

If I want to also concatenate that second parameter to it, How would the URL look like?

Upvotes: 0

Views: 51

Answers (1)

davidrac
davidrac

Reputation: 10738

The way it would look is:

http://localhost:3000/pharmacy/patients?provider=234&thera_class=Nasal Congestion

To be extra strict, spaces are replaced by %20 in the URL:

http://localhost:3000/pharmacy/patients?provider=234&thera_class=Nasal%20Congestion

Upvotes: 1

Related Questions