2017-08-22 5 views
0

Flashメッセージがあり、リンクメッセージタグを追加して、ユーザーがFlashメッセージ内のリンクを持つことができます。私の問題は、エラーが未定義のメソッド `link_to 'を得ていることです。コントローラーでlink_toを使用したFlashメッセージ

sessions_controller.rb

def create 
    user = User.find_by_email(params[:sessions][:email].downcase) 

    if user.activated? 
    //Log User In 
    else 
    flash[:warning] = "Account not activated. Check your email for the activation link. #{link_to('Resend Activation Email', user.send_activation_email)}" 
    redirect_to root_url 
    end 

    flash[:warning] = "Account not activated. Check your email for the activation link. #{link_to('Resend Activation Email', user.send_activation_email)}" 
end 

は、コントローラのメソッド内のlink_toを追加することが可能ですか?

答えて

1

あなたは使用することができます。

ActionController::Base.helpers.link_to('Resend Activation Email', user.send_activation_email) 
関連する問題