I worked a bit with this, and I found a solution that might help you a little better.
Step 1
BEFORE you create your scaffold, make sure your inflections.rb file has the correct bend.
ActiveSupport::Inflector.inflections do |inflect| inflect.irregular 'pokem', 'pokemon' end
Step 2
Now you can create your scaffold
[bruno ~/pokedex]$ script/generate scaffold pokem name:string
Step 3
Check out our great new routes!
[bruno ~/pokedex]$ rake routes pokemon GET /pokemon(.:format) {:controller=>"pokemon", :action=>"index"} POST /pokemon(.:format) {:controller=>"pokemon", :action=>"create"} new_pokem GET /pokemon/new(.:format) {:controller=>"pokemon", :action=>"new"} edit_pokem GET /pokemon/:id/edit(.:format) {:controller=>"pokemon", :action=>"edit"} pokem GET /pokemon/:id(.:format) {:controller=>"pokemon", :action=>"show"} PUT /pokemon/:id(.:format) {:controller=>"pokemon", :action=>"update"} DELETE /pokemon/:id(.:format) {:controller=>"pokemon", :action=>"destroy"}
Note
If you create your scaffold before , you define your inflection, named routes will not be updated.
source share