Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Devise's "current_user" not available at the model layer?

There are many posts about Devise and the lack of availability of "current_user" for use in models. There are numerous work arounds posted here and elsewhere. However, i haven't found the answer to "why" in any of the posts. Is this a security issue? If not, why?

like image 406
Jay Avatar asked May 04 '11 13:05

Jay


1 Answers

Because you don't have access to a session variable inside a model, it's not a Devise issue or something related to security. It's related to the MVC pattern used in Rails.

like image 155
Matteo Alessani Avatar answered Oct 08 '22 15:10

Matteo Alessani