dboyd68
dboyd68

Reputation: 1114

rake routes not correct

Strange issue I originally generated a scaffold for an object.

I mistyped it and called it Medium, instead I meant Media. I updated everything manually and most if it is fine.

Problem: the routes are not correct.

My routes.rb now looks like

MediaLoader::Application.routes.draw do
  resources :media
  match '/signout', to: 'sessions#destroy'
  match '/signin', to: 'sessions#new'
end

However when I run rake route I get

     media GET    /media(.:format)          media#index
            POST   /media(.:format)          media#create
 new_medium GET    /media/new(.:format)      media#new
edit_medium GET    /media/:id/edit(.:format) media#edit
     medium GET    /media/:id(.:format)      media#show
            PUT    /media/:id(.:format)      media#update
            DELETE /media/:id(.:format)      media#destroy
    signout        /signout(.:format)        sessions#destroy
     signin        /signin(.:format)         sessions#new

NOTICE new_medium

Thoughts on why this is. I cannot find medium anywhere p.s I am using Rubymine running in editor dev server.

Upvotes: 0

Views: 78

Answers (1)

hiattp
hiattp

Reputation: 2336

I think this is a bit of Rails magic, the inflector singularizes "media" into "medium", and is doing that automagically for you in the route helpers.

Upvotes: 2

Related Questions