iCyborg
iCyborg

Reputation: 4728

What is the difference between current_user and @current_user (I am using devise) ?

I know @current_user is instance variable but I am still unclear about the difference between current_user and @current_user ? when should i use current_user and when @current_user ?

Upvotes: 2

Views: 898

Answers (2)

Zero Fiber
Zero Fiber

Reputation: 4465

current_user is the helper method provided by devise to access the current user. There is nothing like @current_user from devise unless you have set it in your code.

Upvotes: 0

nohm
nohm

Reputation: 26

In my personal experience with devise I never use @current_user, current_user always suffices wherever and whenever I want.

The official documentation only mentions current_user too. Devise Controllers filters and helpers

Upvotes: 1

Related Questions