Hi my prefix in rails routes is invisible.
Here is my file routes.rb
Rails.application.routes.draw do
get '/gossip/:id', to: 'gossip#show'
get '/welcome/:user_entry', to: 'welcome#personnal'
root 'home#show'
get '/team', to: 'team#show'
get '/contact', to: 'contact#show'
end
And when i run rails routes in terminal i see that :
Prefix Verb URI Pattern Controller#Action
GET /gossip/:id(.:format) gossip#show
GET /welcome/:user_entry(.:format) welcome#personnal
root GET / home#show
team GET /team(.:format) team#show
contact GET /contact(.:format) contact#show
rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show
rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show
rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show
update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update
rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create
If i remove the :
before id
i see the prefix but my routes is not anymore dynamic. Any tips? thanks
You can make the route named by adding as: :some_route_name
:
get '/gossip/:id', to: 'gossip#show', as: :gossip
or use:
resources :gossip, only: [:show]