Skip to main content

Why devise helpers are not available in application controller, except authenticate_user! ?

Rails • Asked by naveen kumar

undefined local variable or method `user_signed_in' in application controller

but working fine in application.html.erb

if user_signed_in

layout 'admin_lte_2'
else
layout 'some_other_layout'
end
why is that?


I think you have a typo. It's user_signed_in? not user_signed_in. That should do the trick!

if user_signed_in?
  layout 'admin_lte_2'
else 
  layout 'some_other_layout'
end

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.