EastsideDev
EastsideDev

Reputation: 6649

Rails: Devise - user_signed_in not recognized

I am using Devise with a Registration model/controller/views (to do new registration) and a User model to do Edit/Update/Show.

Everything seems to be working fine (registration, confirmation, etc.). I am having a problem when I try to use the user_signed method in my application. I am getting the following error message:

undefined local variable or method `user_signed_in'

I researched this issue on StackOverflow, and applying what I learned from several Q&A sessions, here's what I did:

In my User model (user.rb), I have the following:

devise :database_authenticatable

In my User controller, I added the following:

before_filter :authenticate_user!

But I'm still getting the error. I also tried adding the before_filter to the Registration controller and the Application controller, but I'm still getting the error message.

Any ideas?

Work Around

I am using some_action if current_user?

as a workaround, but I am still interested in figuring out if anyone has an answer to the original question.

Upvotes: 1

Views: 1822

Answers (1)

DVG
DVG

Reputation: 17480

Try adding a question mark

user_signed_in?

Upvotes: 3

Related Questions