my problem was anytime I traveled to the url /users/1-username/ i got
an error saying the only action was ‘show’
Which did and did not make sense to me. It did make sense becuase the
only action in my controller was show. and in both theory (and I tried
it and it worked) the url should be /users/show/1-username. Which
worked without a problem. But of course the book only user the /users/
1-username/ url.
This is the same thing as stating that you have a RESTful controller
setup and that you have paths in place for all 7 controller methods
(index, show, new, edit, create, update, and destroy).
If you haven’t modified how your routing and paths are going to behave
in each of your controllers then you want to make sure those two lines
are always at the very bottom of the your routes file. Routes have
precedence in place for their order.
If you want to use javascript in your routes you would place something
like this:
map.js ‘:controller/:action.:format’
… at the very bottom as well.
If you wanted a catchall routes type of path set you can set the
following at the bottom:
Thanks for the responses. I think I understand it now so I’ll recap
real quick
// Routes get written in a priority order. Specialized routes on the
top (in this case assuming a RESTful manner from the controllers)
map.resources :users
map.resource :session
map.resources :stories, :has_many => :votes, :collection => { :bin
=> :get }
// And the default layout for all routes not specifically set above
map.root :controller => “stories”
map.connect ‘:controller/:action/:id’
map.connect ‘:controller/:action/:id.:format’