Hi All,
I'm working on a simple asset tracker application, but I've got a bit confused about routes. Briefly, in my application there are users who can have many assets, and each asset can have many incomings or outgoings. In turn, each incoming or outgoing is assigned a category.
What I'd like to do is have every URL start with /users/<username>/ (e.g. /users/johntopley/assets/1). I know about :path_prefix and that you can nest resources, but I haven't been able to work out how to achieve what I'm after. Incidentally, I'm using Edge Rails.
This is my routes file:
ActionController::Routing::Routes.draw do |map| map.home '', :controller => 'assets', :action => 'index'
map.resources :assets, :categories, :incomings, :outgoings, :users
map.signin '/signin', :controller => 'application', :action => 'signin' map.signout '/signout', :controller => 'application', :action => 'signout' map.signup '/signup', :controller => 'application', :action => 'signup'
map.connect ':controller/:action/:id' end
Any help would be greatly appreciated.
John