Ruby on Rails / Devise: Determining in model if user is logged in?

You cannot access the devise user or session from any model due to separation of layers. What you can do is send the the object to the model.

You cannot access the devise user or session from any model due to separation of layers. What you can do is send the the object to the model. I've done something like your solution before and It was just a headache.So in your create action.

Def create if current_user @user. Current_user(true) end end Then just send true/false to a method on the user: def current_user(current_user) current_user end Then you can have a before_create that checks if that is true.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions