0

認証をdevise、次にomniauthで機能させようとしましたが、ユーザーセッションを取得できませんでした。

私のアプリケーションコントローラーには、

class ApplicationController < ActionController::Base

    偽造から守る



プライベート
    def current_user
        @current_user ||= User.find(session[:user_id]) if session[:user_id]
    終わり
    helper_method :current_user

終わり

更新された Railscast から取得したhttps://github.com/railscasts/241-simple-omniauth/blob/master/revised/blog-after/app/controllers/application_controller.rb

私のアプリでは、私は呼び出します

<% if current_user %>

しかし、これは常に次のようにエラーになりますundefined local variable or method 'current_user'

どうしてこれなの?私のアプリケーションコントローラーの問題ですか、それともレールのセッションエラーですか?

4

0 に答える 0