设计没有路由匹配会话/用户?

时间:2011-08-18 22:07:05

标签: ruby-on-rails devise

我使用rails 3项目设置Devise身份验证,当我点击登录按钮时,它会显示:

No route matches "/session/user"

无论我是否使用有效凭证..

继承我的设计形式(我没有默认编辑)

<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:novalidate => 'novalidate'}) do |f| %>

有什么建议吗?

更新

的routes.rb

SpecimenTracker::Application.routes.draw do
  devise_for :users

  resources :users
resources :results
  resources :session
match "/results/show" => "results#show"
match "/messages/show" => "messages#show"
match "/login/index" => "login#index"
match "/login/authenticate" => "login#authenticate"
  # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
get 'home/index'
root :to => 'home#index'
  # See how all your routes lay out with "rake routes"

  # Install the default routes as the lowest priority.
  # Note: These default routes make all actions in every controller accessible via GET requests. You should
  # consider removing the them or commenting them out if you're using named routes and resources.
end

Gemfile(仅为设计添加的部分)

gem 'net-ldap'

gem "devise", "~> 1.4"
gem "devise_ldap_authenticatable"


gem 'hpricot'
gem 'ruby_parser'

rake路由的输出(底部的所有会话都来自我尝试使用的旧身份验证系统但随后被转储。不应该影响任何东西..对吗?)

  new_user_session GET    /users/sign_in(.:format)      {:controller=>"devise/sessions", :action=>"new"}
        user_session POST   /users/sign_in(.:format)      {:controller=>"devise/sessions", :action=>"create"}
destroy_user_session DELETE /users/sign_out(.:format)     {:controller=>"devise/sessions", :action=>"destroy"}
               users GET    /users(.:format)              {:controller=>"users", :action=>"index"}
                     POST   /users(.:format)              {:controller=>"users", :action=>"create"}
            new_user GET    /users/new(.:format)          {:controller=>"users", :action=>"new"}
           edit_user GET    /users/:id/edit(.:format)     {:controller=>"users", :action=>"edit"}
                user GET    /users/:id(.:format)          {:controller=>"users", :action=>"show"}
                     PUT    /users/:id(.:format)          {:controller=>"users", :action=>"update"}
                     DELETE /users/:id(.:format)          {:controller=>"users", :action=>"destroy"}
             results GET    /results(.:format)            {:controller=>"results", :action=>"index"}
                     POST   /results(.:format)            {:controller=>"results", :action=>"create"}
          new_result GET    /results/new(.:format)        {:controller=>"results", :action=>"new"}
         edit_result GET    /results/:id/edit(.:format)   {:controller=>"results", :action=>"edit"}
              result GET    /results/:id(.:format)        {:controller=>"results", :action=>"show"}
                     PUT    /results/:id(.:format)        {:controller=>"results", :action=>"update"}
                     DELETE /results/:id(.:format)        {:controller=>"results", :action=>"destroy"}
       session_index GET    /session(.:format)            {:controller=>"session", :action=>"index"}
                     POST   /session(.:format)            {:controller=>"session", :action=>"create"}
         new_session GET    /session/new(.:format)        {:controller=>"session", :action=>"new"}
        edit_session GET    /session/:id/edit(.:format)   {:controller=>"session", :action=>"edit"}
             session GET    /session/:id(.:format)        {:controller=>"session", :action=>"show"}
                     PUT    /session/:id(.:format)        {:controller=>"session", :action=>"update"}
                     DELETE /session/:id(.:format)        {:controller=>"session", :action=>"destroy"}
        results_show        /results/show(.:format)       {:controller=>"results", :action=>"show"}
       messages_show        /messages/show(.:format)      {:controller=>"messages", :action=>"show"}
         login_index        /login/index(.:format)        {:controller=>"login", :action=>"index"}
  login_authenticate        /login/authenticate(.:format) {:controller=>"login", :action=>"authenticate"}
          home_index GET    /home/index(.:format)         {:controller=>"home", :action=>"index"}
                root        /(.:format)                   {:controller=>"home", :action=>"index"}

1 个答案:

答案 0 :(得分:0)

检查你的config / routes.rb,是否有设计线? 如果没有,您可能想要运行

rails generate devise_install

rails generate devise User