简体   繁体   中英

Change URI Pattern in rails 5

I have this in the routes.rb

get 'search#search', to: 'search#search', as: 'search'

and if I rails routes it returns the following:

search GET    /search%23search(.:format)        search#search

I would like to change the /search%23search to search/search

How can I do this?

In rails you write as:

get 'search/search', to: 'search#search', as: 'search'

This will result to:

search GET    /search/search(:format)        search#search

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM