RailsアプリでURLを単純化するだけです。
/nature
代わりは/categories/nature
私のroutes.rb
:
match 'categories/:id' => 'categories#show'
RailsアプリでURLを単純化するだけです。
/nature
代わりは/categories/nature
私のroutes.rb
:
match 'categories/:id' => 'categories#show'
match ':id' => 'categories#show'
ただし、これは show アクションを使用して「/something」へのリクエストをカテゴリ コントローラーに送信するため、それを考慮する必要があります。
私があなただったら、次のようにします。
match ':id' => 'categories#show',:constraints => { :id => /nature|sports|architecture|people|.../ }
このようにして、利用可能なカテゴリのいずれにも一致しない限り、必要に応じて「/something」ルートを使用できます。