Having an issue with my routes that is confusing me. Basically I have a user Has_many workers and a worker belongs_to a user active record setup. So I wanted to do nested routes. Below is my routes file
resources :users do
resources :workers
end
resources :sessions, only: [:new, :create, :destroy]
root to: 'info_pages#home'
match '/contact', to: 'info_pages#contact'
match '/about', to: 'info_pages#about'
match '/signup', to: 'users#new'
match '/signin', to: 'sessions#new'
match '/signout', to: 'sessions#destroy', via: :delete
match '/pools', to: 'pools#new'
match '/settings', to: 'info_pages#settings'
I run rake routes and I see all the nested routes
I went in to my worker controller and have this code
class WorkersController < ApplicationController
def new
end
def show
end
def update
end
def create
end
end
Now when I try to load the page with this link
<li><%= link_to "Workers", new_user_worker_path %></li>
The load fails saying "No route matches {:action=>"new", :controller=>"workers"}"
Im not sure why its failing on this route when I clearly have it defined in the routes file and Maybe my controller isn't setup correctly for the nested routes. Thank you!