当我尝试在Rails应用程序上使用devise登录时,出现以下错误。
没有路由与[POST]“ / sessions / user”匹配
我尝试了在这里找到的其他解决方案,但是它们似乎不起作用。
我的routes.rb
文件中包含以下内容。
Rails.application.routes.draw do
devise_for :users
resources :non_availabilities
resources :sessions
resources :programs
resources :activities
resources :locations
resources :employees
resources :expertises
resources :emp_classifications
resources :educations
get 'dashboard/index'
root 'dashboard#index'
end.
我该如何解决?
答案 0 :(得分:0)
您可以将此行添加到路线中吗
Process: Python [23472]
Path: /usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier: Python
Version: 3.7.0 (3.7.0)
Code Type: X86-64 (Native)
Parent Process: zsh [22997]
Responsible: Python [23472]
User ID: 501
Date/Time: 2018-10-09 14:39:32.725 +0800
OS Version: Mac OS X 10.14 (18A391)
Report Version: 12
Anonymous UUID: D946F646-E90A-A450-14FB-63EA96A4C90E
Time Awake Since Boot: 18000 seconds
System Integrity Protection: disabled
Crashed Thread: 3 Dispatch queue: com.apple.root.default-qos
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace TCC, Code 0x0
答案 1 :(得分:0)
我遇到了完全相同的情况(我的应用程序也有Session
模型和SessionsController
)。 This solution为我工作,但做了一点修改。以下代码已添加到config/routes.rb
:
devise_scope :user do
match '/sessions/user', to: 'devise/sessions#create', via: :post
end