2016-01-06 49 views
1

我使用的設計認證,和我的應用程序發送電子郵件確認,但是當我點擊「確認我的帳戶」我有這樣的錯誤:設計,ActionController的:: UnknownFormat

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> 
+0

添加此respond_to :html, :json線顯示您的確認控制器中的代碼 –

+0

對不起,我在RoR大三,我沒有在app/controllers中看到confirmations_controller.rb。這個控制器不可見? –

+0

這個控制器是由devise實現的,但是可以被開發人員覆蓋,這就是爲什麼我問。你面臨的問題很可能與其中的'respond_to'塊有關。但是如果你沒有覆蓋它的任何行動,我不知道,你使用哪個版本的設計? –

回答

0

只是在你application controller

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

不工作。同樣的錯誤。 –

+0

您可以嘗試在link_to標記中添加':format =>:html'嗎? –

+0

Omg,同樣的錯誤。什麼..... –

相關問題