[Ruby] How to deal with undefined method `user_signed_in?’

less than 1 minute read

I will summarize what I learned and stumbled on every day. If you find any mistakes, please let us know! I’m always helped by other people’s articles, so I hope it helps.

What kind of error

Error that user_signed_in helper method is not defined, which can be used with devise.

What happens when

  1. When devise is not installed.
  2. When there is no description such as devise_for :users in routes.rb.


1. Describe the following in the Gemfile.


Run the following in the terminal:

install gem

bundle install

Create configuration file

rails g devise:install

Create a model corresponding to the login function

rails g devise user

Create table related to login function

bundle exec rake db:migrate

2. Write the following in routes.rb

devise_for :users