0

I have this route:

match 'items/:location_no/:item_no' => 'items#location_item', :constraints => { :location_no => /.*/, :item_no => /.*/ }

I call it with this link: http://localhost:3000/items/whs/65484 which gives me this error:

No route matches {:action=>"edit", :controller=>"item_details"}

The item number (it's not an id field) is 65484 but if I change it to have one alphabetical letter like 65484s (http://localhost:3000/items/whs/65484s) it goes into the correct controller (although it doesn't find the item because of the bogus s at the end). What can be causing it to not match the route when only number? I have tried to skip the constraints in the route with the same effect.

As requested, these are the item routes:

             item_details GET    /item_details(.:format)                          item_details#index
                          POST   /item_details(.:format)                          item_details#create
          new_item_detail GET    /item_details/new(.:format)                      item_details#new
         edit_item_detail GET    /item_details/:id/edit(.:format)                 item_details#edit
              item_detail GET    /item_details/:id(.:format)                      item_details#show
                          PUT    /item_details/:id(.:format)                      item_details#update
 autocomplete_item_name_items GET    /items/autocomplete_item_name(.:format)          items#autocomplete_item_name
       edit_item_history_item GET    /items/:id/edit_item_history(.:format)           items#edit_item_history
                        items GET    /items(.:format)                                 items#index
                              POST   /items(.:format)                                 items#create
                     new_item GET    /items/new(.:format)                             items#new
                    edit_item GET    /items/:id/edit(.:format)                        items#edit
                         item GET    /items/:id(.:format)                             items#show
                              PUT    /items/:id(.:format)                             items#update
                              DELETE /items/:id(.:format)                             items#destroy
                                     /items/:location_no/:item_no(.:format)           items#location_item {:location_no=>/.*/}
4

0 回答 0