Static routes no longer working, passing id
I had routes like this
/state/arizona/unit/AZ22
I wanted to remove the controller names of STATE and UNIT and get routes
like this
/arizona/AZ22
Found this code which worked great
resources :states, :except => [:index ], :path => '/' do
resources :units, :except => [:index ], :path => '/'
end
But now my static paths don't work because it thinks it is a state. I have
a list of States on the static pages.
Error: Couldn't find State with id=about
Code throwing error : def set_state
@state = State.friendly.find(params[:id])
end
These are my static page routes
match '/contact', to: 'static_pages#contact', via: 'get'
match '/about', to: 'static_pages#about', via: 'get'
root 'static_pages#home'
Is there a way to fix the routes? Or did I use static pages wrong because
I'm feeding a list of states to them?
No comments:
Post a Comment