restful routing help

Ok so I am making a directory, the flow of the directory should be category to state to county to city to zip. I cant get it to work so that when you click on a certain category it links to you all the states it has. so far this is what i have.

routes.rb

map.resources :categories, :has_many => :states map.resources :states, :has_many => :counties ...........

So they start off in the show action of the categories controller which is

categories_controller.rb

def show     @categories = Category.find(:all)     respond_to do |format|       format.html # index.html.erb       format.xml { render :xml => @categories }     end   end

here is my show view for categories

show.html.erb

<h1>Listing categories</h1> <table> <% for category in @categories %>   <tr>     <td>     <%= link_to category.title, state_path(@state) %></td>   </tr> <% end %> </table>

here is my states controller

states_controller.rb

def index     @states = @category.states     respond_to do |format|       format.html # index.html.erb       format.xml { render :xml => @states }     end   end

and here is my index view for states

index.html.erb

<h1>Listing States</h1> <table> <% for states in @categories.states %>   <tr>     <td><%= link_to state.title, county_path(@county)%></td>   </tr> <% end %> </table>

now I can get to the categories view and see all the categories but when I click on a specific category to go to show all the states it has it throws a error. Any help would be greatly appreciated, thnks in advance.

Does anyone know? or can point me in the right direction?