This project is archived and is in readonly mode.
RoutingError (No Route Matches) after adding irregular inflector
-
Aditya Sanghi
- Importance changed from to Low
run rake routes to see the routes created for your app.
I assume if you have this irregular noun aircraft set with the same plural and singular word, rails would generate routes something like this --
aircraft_index GET /aircraft(.:format) {:action=>"index", :controller=>"aircraft"} POST /aircraft(.:format) {:action=>"create", :controller=>"aircraft"} new_aircraft GET /aircraft/new(.:format) {:action=>"new", :controller=>"aircraft"} edit_aircraft GET /aircraft/:id/edit(.:format) {:action=>"edit", :controller=>"aircraft"} aircraft GET /aircraft/:id(.:format) {:action=>"show", :controller=>"aircraft"} PUT /aircraft/:id(.:format) {:action=>"update", :controller=>"aircraft"} DELETE /aircraft/:id(.:format) {:action=>"destroy", :controller=>"aircraft"}On line 3, you would need to use the link as
<%= link_to("Aircraft", aircraft_index_path) %>You would get this problem if you added the inflection after the scaffolding.
-
Santiago Pastorino
- State changed from new to invalid
When the singular is equals to the plural we need to append _index at the end to differentiate from the helper which returns the GET for the SHOW. So what Aditya said is right ...
https://github.com/rails/rails/blob/08c64bbd390d1ba6b44d29c5892693e...
-
Philip Nelson
I managed to work this out last night, when I realized while reading the routing section of AWDWR that following the standard pattern for named paths would result in a clash of names. I'm glad that they thought of this already, and indeed changing to application as suggested does make it work.
What does concern me, and I often find this with Rails, is that the error messages you receive really don't give you any clue as to what the real cause of the problem is. it is the one thing about the Rails framework which I find challenging. It is all very well having all the Rails goodness, but if when you make a mistake you get such cryptic messages it means you lose a lot of the momentum. I guess many of these things come with experience ... hence the reason my bookshelf (both paper and electronic) is becoming full of books on Ruby, Rails, AJAX, etc.
