没有路线匹配[GET]" / sign_in"

时间:2015-07-09 09:32:35

标签: ruby-on-rails ruby angularjs devise

使用AngularJS和Ruby on Rails设置身份验证。请尝试根据本文https://www.airpair.com/ruby-on-rails/posts/authentication-with-angularjs-and-ruby-on-rails进行操作。但是当运行时,使用rspec的测试具有相同的错误

Authentication login with valid inputs
     Failure/Error: Unable to find matching line from backtrace
     ActionController::RoutingError:
       No route matches [GET] "/sign_in"

在rake路线中有:

                  Prefix Verb   URI Pattern                            Controller#Action
        new_user_session GET    /users/sign_in(.:format)               devise/sessions#new
            user_session POST   /users/sign_in(.:format)               devise/sessions#create
    destroy_user_session GET    /users/sign_out(.:format)              devise/sessions#destroy
           user_password POST   /users/password(.:format)              devise/passwords#create
       new_user_password GET    /users/password/new(.:format)          devise/passwords#new
      edit_user_password GET    /users/password/edit(.:format)         devise/passwords#edit
                         PATCH  /users/password(.:format)              devise/passwords#update
                         PUT    /users/password(.:format)              devise/passwords#update
cancel_user_registration GET    /users/cancel(.:format)                devise/registrations#cancel
       user_registration POST   /users(.:format)                       devise/registrations#create
   new_user_registration GET    /users/sign_up(.:format)               devise/registrations#new
  edit_user_registration GET    /users/edit(.:format)                  devise/registrations#edit
                         PATCH  /users(.:format)                       devise/registrations#update
                         PUT    /users(.:format)                       devise/registrations#update
                         DELETE /users(.:format)                       devise/registrations#destroy
       user_confirmation POST   /users/confirmation(.:format)          devise/confirmations#create
   new_user_confirmation GET    /users/confirmation/new(.:format)      devise/confirmations#new
                         GET    /users/confirmation(.:format)          devise/confirmations#show
                    root GET    /                                      devise/sessions#new
               user_root GET    /persons/profile(.:format)             persons#profile
               next_page GET    /index(.:format)                       persons#index
                         GET    /omniauth/:provider/callback(.:format) devise_token_auth/omniauth_callbacks#redirect_callbacks

1 个答案:

答案 0 :(得分:0)

正如您的shell_exec('split --bytes='. $fb_response["end_offset"] . ' --suffix-length=1 --numeric-suffixes '. $this->filepath .' $chunkfilepath' ); 所说......您需要routes /users/sign_in请求GET。 您正在使用不存在的/sign_in ... 你可以直接使用new_user_session_path 如果您确实想使用/ sign_in,请编辑您的路线并添加此

  get 'sign_in' => 'devise/sessions#new'