Search code examples
spreesolidus

How come 'current_spree_user' is available in the views, while it is not an instance variable


I'm using Solidus/Spree.

Normally when you use variables from the controller, you use instance variables that start with an @.

In my views, I have seen the use of current_spree_user which is not an instance variable, but it does work. I don't see this local variable 'current_spree_user' being assigned somewhere in my view.

Anybody knows how it is possible that current_spree_user is an valid variable within a view?


Solution

  • It's not an controller instance variable, but controller helper method : https://github.com/spree/spree_auth_devise/blob/master/lib/spree/authentication_helpers.rb