[RUBY] What to do when undefined method ʻuser_signed_in?'

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

What kind of error is it

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

When it happens

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

approach

Describe the following in the Gemfile.

gem 'devise'

Do the following in the terminal:

install gem

bundle install

Create configuration file

rails g  devise:install

Create a model that supports the login function

rails g devise user

Create a table related to the login function

bundle exec rake db:migrate

Describe the following in routes.rb

devise_for :users

Recommended Posts

What to do when undefined method ʻuser_signed_in?'
What to do when javax.batch.operations.JobStartException occurs
What to do when Method not found in f: ajax
What to do when Cannot apply expression operators to method binding
What to do when a javax.el.PropertyNotWritableException occurs
What do you use when converting to String?
What to do when The SSL certificate has expired
What to do if ClassNotFoundException occurs when starting Tomcat
What to do when a null byte error occurs
What to do when rails creates a 〇〇 2.rb file
Error ExecJS :: RuntimeUnavailable: What to do when it occurs
ParseException: What to do when Unparseable date is reached
What to do when it becomes Unable to find CDI BeanManager.
What to do when you launch an application with rails
What to do after Vagrant install
[Ruby / Rails] What to do when NoMethodError appears when using a destructive method such as filter!
[Rails] What to do when the view collapses when a message is displayed with the errors method
What to do when an UnsupportedCharsetException occurs in a lightweight JRE
What to do when the changes in the Servlet are not reflected
[Rails] What to do when rails s does not respond or does not stop
java.security.InvalidKeyException: What to do when Illegal key size or default parameters
What to do when you become a Problem During Content Assist
What to do when you run into a docker-compose node_modules problem
What to do when you want to know the source position where the method is defined in binding.pry
What to do when javax.el.ELException: Not a Valid Method Expression: appears when the JSF screen is displayed
What to do after updating Dockerfile, docker-compose.yml
What to do if you install Ubuntu
[IOS] What to do when the image is filled with one color
What to do when CentOS cannot be started with VirtualBox on Catalina
What to do when Blocked Host: "host name" appears in Ruby on Rails
What to do and how to install when an error occurs in DXRuby 1.4.7
Notes on what to do when EC2 is set up with t2.micro
What to do if tomcat process remains when tomcat is stopped in eclipse
What to do if you get an error when you hit Heroku logs
What to do when "call'Hoge.connection' to establish a connection" appears on rails c
Notes on what to do when a WebView ClassNotFoundException occurs in JavaFX 12
What to do when you want to delete a migration file that is "NO FILE"
What to do when you think you can't do Groovy-> Java in IntelliJ IDEA CE
<f: ajax> Unable to attach <f: ajax> to non-ClientBehaviorHolder What to do when you become a parent
What to do when the value becomes null in the second getSubmittedValue () in JSF Validator
Method to search
What to do when rails db: seed does not reflect in the database
[Ruby] I want to do a method jump!
What to do immediately after introducing Material Design
When you want to use the method outside
[Grails] Error occurred running What to do when the Grails CLI does not start
What to do if you push incorrect information
What to do if mvn archetype: generate fails
What I did when I converted java to Kotlin
What to do when "Nil location provided. Can't build URI." Appears on CarrierWave
undefined method `** _ path'error
What to do when is invalid because it does not start with a'-'
What to do if ffi installation fails when launching an application in Rails
[Ubuntu] What to do when MongoDB cannot be started due to a SocketException error
WELD-001408: What to do when Unsatisfied dependencies for type Bean with qualifiers @Default
What to do when booting Ubuntu on WSL2 and getting "Process terminated with code 1"
[React.useRef] What to do when the latest state cannot be referenced in the event listener
After installing'devise''bootstrap' of gemfile with rails, what to do when url is an error
What to do when rbenv says that there is no readline or lib history
What to do if you get a NoClassDefFoundError when trying to run eclipse on Java9
What to do when build fails by rbenv install / pyenv install with anyenv (Debian system)