繁体   English   中英

设计,ActionController :: UnknownFormat

[英]Devise, ActionController::UnknownFormat

我正在使用devise进行身份验证,并且我的应用程序发送带有确认的电子邮件,但是当我单击“确认我的帐户”时,出现此错误:

ActionController的:: UnknownFormat

我的问题在哪里?

我的application_controller.rb

class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception
  before_action :configure_permitted_parameters, if: :devise_controller?

  def authenticate_admin_user!
    authenticate_user!
    redirect_to root_path unless current_user.admin?
  end

  protected

  def configure_permitted_parameters
    devise_parameter_sanitizer.for(:sign_up) << :first_name << :last_name
  end
end

我的Confirmation_instructions.html

<p>Welcome <%= @email %>!</p>

<p>You can confirm your account email through the link below:</p>

<p><%= link_to 'Confirm my account', user_confirmation_url(@resource, confirmation_token: @token) %></p>

只需在application controller添加此respond_to :html, :json

class ApplicationController < ActionController::Base
  respond_to :html, :json
  ...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM