Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Current_user devise method returns nil outside the user controller

Is this a scope/routes problem? The current_user works in the user controller. Outside, in another controller/view, this returns nil. Even if the user is logged in, the user_signed_in? method returns false. I know I am missing something, just not able to point my finger. What is the right way to do this?

like image 918
Saran Avatar asked Apr 26 '26 10:04

Saran


1 Answers

It works for me in other controllers. A wild guess: maybe the other controller needs: before_filter :authenticate_user!

like image 72
Ernst Avatar answered Apr 28 '26 22:04

Ernst



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!