Ruby on rails 设计错误:“;“您已登录”;数据库中没有用户(Rails 5)

Ruby on rails 设计错误:“;“您已登录”;数据库中没有用户(Rails 5),ruby-on-rails,ruby,devise,Ruby On Rails,Ruby,Devise,我正在使用Desive对我的客户进行身份验证,但是,当我点击视图中的注册按钮时,它会让我觉得我已经登录了,这是怎么回事?我的数据库中甚至没有用户 routes.rb Rails.application.routes.draw do devise_for :clients, controllers: { registrations: 'clients/registrations', sessions: 'clients/sessions' } root to: "mainpages#ind

我正在使用Desive对我的客户进行身份验证,但是,当我点击视图中的注册按钮时,它会让我觉得我已经登录了,这是怎么回事?我的数据库中甚至没有用户

routes.rb

Rails.application.routes.draw do
  devise_for :clients, controllers: { registrations: 'clients/registrations', sessions: 'clients/sessions' }
  root to: "mainpages#index"

  get '/mainpages', controller: 'mainpages', action: 'index'
  get '/planes', controller: 'planes', action: 'planes'

  resources :planes
我的控制器位于控制器/客户机内部,目前我想激活所有与注册和会话相关的功能,所以这里是我的注册控制器

注册\u控制器

class Clients::RegistrationsController < Devise::RegistrationsController
   before_action :configure_sign_up_params, only: [:create]
   before_action :configure_account_update_params, only: [:update]
  # GET /resource/sign_up
   def new
     super
     @client = Client.new
   end

  # POST /resource
   def create
     super
     @client = Client.new(client_params)

     #Set user perms to provider or to client

       if @client.perms == false
         @client.perms = "Client"
       else
         @client.perms = "Provider"
       end

         @client.status = "Not activated"

       if @client.save 
         return redirect_to :root
       end
       render 'new'
   end

   protected

   def configure_sign_up_params
     devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
   end

  # The path used after sign up.
   def after_sign_up_path_for(resource)
     super(resource)
   end

  private
  def client_params
    params.require(:client).permit(:name, :last_name, :email, :country, :username, :city, :address, :date, :perms, :status)
  end
end

# frozen_string_literal: true

class Clients::SessionsController < Devise::SessionsController
  # before_action :configure_sign_in_params, only: [:create]

  # GET /resource/sign_in
  def new
    super
  end

  # POST /resource/sign_in
  def create
    super
  end

  # DELETE /resource/sign_out
  def destroy
    super
  end

  protected

  # If you have extra params to permit, append them to the sanitizer.
  def configure_sign_in_params
    devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
  end
end

class Client::RegistrationController
会话\u控制器

class Clients::RegistrationsController < Devise::RegistrationsController
   before_action :configure_sign_up_params, only: [:create]
   before_action :configure_account_update_params, only: [:update]
  # GET /resource/sign_up
   def new
     super
     @client = Client.new
   end

  # POST /resource
   def create
     super
     @client = Client.new(client_params)

     #Set user perms to provider or to client

       if @client.perms == false
         @client.perms = "Client"
       else
         @client.perms = "Provider"
       end

         @client.status = "Not activated"

       if @client.save 
         return redirect_to :root
       end
       render 'new'
   end

   protected

   def configure_sign_up_params
     devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
   end

  # The path used after sign up.
   def after_sign_up_path_for(resource)
     super(resource)
   end

  private
  def client_params
    params.require(:client).permit(:name, :last_name, :email, :country, :username, :city, :address, :date, :perms, :status)
  end
end

# frozen_string_literal: true

class Clients::SessionsController < Devise::SessionsController
  # before_action :configure_sign_in_params, only: [:create]

  # GET /resource/sign_in
  def new
    super
  end

  # POST /resource/sign_in
  def create
    super
  end

  # DELETE /resource/sign_out
  def destroy
    super
  end

  protected

  # If you have extra params to permit, append them to the sanitizer.
  def configure_sign_in_params
    devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
  end
end

#冻结的字符串文字:true
类客户端::会话控制器<设计::会话控制器
#在\操作之前:在\参数中配置\签名\仅:[:创建]
#获取/资源/登录\u
def新
超级的
结束
#发布/资源/登录
def创建
超级的
结束
#删除/资源/注销
def销毁
超级的
结束
受保护的
#如果要允许使用额外的参数,请将它们附加到消毒液中。
def configure_sign_in_参数
设计\u参数\u消毒器。允许(:登录,键:[:属性])
结束
结束
index.html.erb视图/主页/

<div class="col-sm-6"><h4>Not a member?</h4>
    <%= link_to '<p>You can create an account:</p>'.html_safe, controller: "clients/registrations", action:"new" %>
        <p class="text-center">
            <%= link_to '<i class="fas fa-sign-in-alt big-icon"></i>'.html_safe, controller: "clients/registrations", action:"new" %>
        </p>
</div>
不是会员吗?


我试图通过键入localhost:3000/clients/sign_out手动注销,但我遇到了一个路由错误,如果我不退出该会话,我的注册页面链接将无法工作,我尝试重新启动服务器,但仍然出现相同的错误

仅通过键入localhost:3000/clients/sign_out注销将不起作用,因为它需要http请求中的DELETE动词,而不是GET。您是否尝试创建注销链接<代码>
除此之外,我假设我们的自定义控制器中的代码混淆了内容。仅通过键入localhost:3000/clients/sign\u out注销将不起作用,因为它需要http请求中的DELETE动词,而不是GET。您是否尝试创建注销链接<代码>除此之外,我认为我们的自定义控制器中的代码是混合的。