← Back to Upcase

Changing the Get routes for better readability


(Amit Solanki) #1

I would like to know how can one change the following get request into much better readability form

http://localhost:3000/search?utf8=✓&destination=Mumbai%2C+Maharashtra%2C+India&guests=1&bedrooms=1

into

http://localhost:3000/search/Mumbai-Maharashtra-India?guests=1&bedrooms=1

small gist of the routes.rb file

resources :search, only: :index  

I tried to edit the routes file into something like this

resources :search, only: :index 
get 'search/:destination' => 'search#index', as: search

the above works fine when i directly type in the url
but I cant create a form which takes the input from the user and post it in the particular format.

Am sorry but I guess the forum has changed a bit. I can’t set the category to ruby. I dont know why. maybe because my subscription ended?


(Charlieanna) #2

Dude. Mumbai? Maharashtra? kaise ho? :wink:


(Amit Solanki) #3

Maze mein. But pehle problem solve karo bhai. tum Mumbai se ho?


(Charlieanna) #4

I think maine tum logo ko apna resume bheja tha. yaar problem badi lag rahi he tum log ki. solution dekha chahta hu main bas yaha ;). baad me dekhta hu mann hua toh solve karke ki try karunga.

haa Mumbai Nariman point.


(Charlieanna) #5

See this if it helps u


(Amit Solanki) #6

I know about friendly urls, that is not the solution to it, Btw tumhara naam kya hai? kab bheja tha?


(Charlieanna) #7

Ankur Kothari. I think a month back.


(Amit Solanki) #8

Send me again.


(Charlieanna) #9

nahi it’s ok. I joined a product tech company a month back. Main bas bata raha tha. Tumhaara naaam kahi suna hua laga toh check kiya toh roomnhouse se yad aaya ki resume bheja tha maine.