Ask A Question

Notifications

You’re not receiving notifications from this thread.

User_signed_in? doesnt work

ag01373 asked in General

Whenever I request for a user_signed_in?' I get a "undefined methoduser_signed_in?' for #<#Class:0x0000558f3526b730:0x0000558f352697c8>" error code. The code changes everytime. Im trying to check if the user is logged in to change a "Log In" into a "Log Out" and neither `user_signed_in?' not account_signed_in? works. Please help

Reply

It would certainly help if you'd provide some of the actual code. The error you're having is that the method user_signed_in? does not exist.

Here are some points I'd suggest you check:

  • what is the Devise resource? is it setup correctly? did you run the generators
  • check routes.rb for something like devise_for :users - if it's not there then the Devise setup is missing
  • try running bundle install and restarting your server (if you haven't already)
  • check that you call before_action :authenticate_user! (typically from your ApplicationController
Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.