[英]Devise, ActionController::UnknownFormat
I am using devise for authentication, and my application send email with confirmation, but when I click 'confirm my account' I have this error: 我正在使用devise进行身份验证,并且我的应用程序发送带有确认的电子邮件,但是当我单击“确认我的帐户”时,出现此错误:
ActionController::UnknownFormat
ActionController的:: UnknownFormat
Where is my problem? 我的问题在哪里?
my application_controller.rb 我的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
my confirmation_instructions.html 我的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>
Just add this respond_to :html, :json
line in your application controller
只需在
application controller
添加此respond_to :html, :json
行
class ApplicationController < ActionController::Base
respond_to :html, :json
...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.