Part 1 current_user not defined

For some reason I’m getting undefined local variable or method current_user when trying to access it in the application.html.erb. Any idea why?

This is like minute 29 of part 1.

Here is what my application controller looks like:

    class ApplicationController < ActionController::Base
  protect_from_forgery

  def sign_in_as(email)
  	session[:current_email] = email
  end

  def current_user
  	OpenStruct.new(email: session[:current_email])
  end
end

@Nicolo It may be because you haven’t declared current_user as a helper method.

try:

class ApplicationController < ActionController::Base
  protect_from_forgery

  def sign_in_as(email)
  	session[:current_email] = email
  end

  def current_user
  	OpenStruct.new(email: session[:current_email])
  end
  helper_method :current_user
end

That did it. Thanks!

Awesome! :thumbsup: