How to define a route in Ruby on Rails
I'm trying to define a route in routes.rb
and I can't do anything from this Ruby on Rails routing guide that will let this error pass.
No route matches {:controller=>"devise/home"}
Here's my routes.rb source.
SchoolCMS::Application.routes.draw do
root :to => "home#index"
devise_for :teachers, :admin
resources :home, :only => :index
resources :admin, :only => :index
resources :events do
resources :event
end
resources :posts d开发者_JS百科o
resources :comments
end
end
Just to be safe I would remove devise_for :teachers, :admin
and split it so that it is
devise_for :teachers
devise_for :admin
I'm not sure you can specify multiple devises the way you use it, see if this fixes your error.
Also try to use path helpers were possible so instead of doing <%= link_to 'Home', :controller => 'home' %>
make it <%= link_to 'Home', homes_path %>
but make sure you define your home as resource :home, :only => :show
since it's a singular resource.
精彩评论