簡體   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