2015-12-22 4 views
-3

Я не могу понять эту ошибку, что я получаю:Rails Uninitialized постоянная ApplicationController :: SessionHelper

ActionController::RoutingError (uninitialized constant ApplicationController::SessionHelper): 
    app/controllers/application_controller.rb:3:in `<class:ApplicationController>' 
    app/controllers/application_controller.rb:1:in `<top (required)>' 
    app/controllers/static_pages_controller.rb:1:in `<top (required)>' 

Это мой контроллер Применение:

class ApplicationController < ActionController::Base 
    protect_from_forgery with: :exception 
    include SessionHelper 
end 

И мой sessions_helper.rb:

module SessionsHelper 

    # Logs in the given user. 
    def log_in(user) 
    session[:user_id] = user.id 
    end 

    # Returns the current logged-in user (if any). 
    def current_user 
    @current_user ||= User.find_by(id: session[:user_id]) 
    end 

    # Returns true if the user is logged in, false otherwise. 
    def logged_in? 
    !current_user.nil? 
    end 

end 

ответ

4

орфографическую ошибку

include SessionsHelper 
+0

Ничего себе слова не могут описать, как я себя чувствую прямо сейчас. – thermobeelearns

Смежные вопросы