[Rails] Use devise to get information about the currently logged in user

Answer

OK with @ user = current_user

  def index
    @user = current_user
    @gears = Gear.where(user_id: @user.id)
  end

Summary

Login is too easy with devise: metal:

Recommended Posts

[Rails] Use devise to get information about the currently logged in user
[Rails] How to get the user information currently logged in with devise
Introduce devise in Rails to implement user management functionality
How to get information about associated tables in many-to-many tables
[rails devise] How to transition users who are not logged in to the login page
[Rails] How to display information stored in the database in view
I want to get the information of the class that inherits the UserDetails class of the user who is logged in with Spring Boot.
[Rails] How to use gem "devise"
[Rails] How to use devise (Note)
About the symbol <%%> in Rails erb
How to use MySQL in Rails tutorial
How to get the date in java
[Note] How to use Rails 6 Devise + cancancan
How to use credentials.yml.enc introduced in Rails 5.2
How to update user edits in Rails Devise without entering a password
Which class should I use to get the date and time in my Rails app (Time, DateTime, TimeWithZone)
The road to Japaneseizing Rails devise error messages
Use [Rails] devise Guest user function (for portfolio)
I tried to organize the session in Rails
[Rails] How to use select boxes in Ransack
How to get the ID of a user authenticated with Firebase in Swift
[Rails6] How to connect the posting function generated by Scaffold with the user function generated by devise
Library "OSHI" to get system information in Java
How to use JQuery in js.erb of Rails6
[Rails] Added in devise: username not added to database
About the case where "Docker" freeter tried to put Docker in the existing Rails application
[Rails] How to use PostgreSQL in Vagrant environment
How to check Rails commands in the terminal
I want to get the value in Ruby
[Swift] Use Swity JSON to easily get information from JSON data of the fortune-telling API
For those who want to use MySQL for the database in the environment construction of Rails6 ~.
Install multiple submit buttons in Rails View to get the value of the pressed button
How to set the display time to Japan time in Rails
[rails] How to use devise helper method before_action: authenticate_user!
Use Extend (Concerns) in Rails to standardize Controller processing.
How to update devise user information without a password
Implement user follow function in Rails (I use Ajax) ②
Source used to get the redirect source URL in Java
[Rails] I don't know how to use the model ...
Implement user follow function in Rails (I use Ajax) ①
[Swift] Use UserDefaults to save data in the app
[Rails] How to get the contents of strong parameters
Questions about implementing the Like feature (Ajax) in Rails
Get location information in Rails and sort in ascending order
Beginners use ubuntu in windows to prepare rails environment
[Rails] How to display an image in the view
Use images in Rails
[rails] About devise defaults
[Ruby on Rails] I want to get the URL of the image saved in Active Storage
Memo that transitions to the login screen if you are not logged in with devise
When you want to reflect the Master Branch information in the Current Branch you are currently working on
How to get the class name / method name running in Java
[Rails] Processing after adding a column to the devise table
How to use the getter / setter method (in object orientation)
[Rails] How to temporarily save the request URL of a user who is not logged in and return to that URL after logging in
How to create a placeholder part to use in the IN clause
How to get the longest information from Twitter as of 12/12/2016
Super easy in 2 steps! How to install devise! !! (rails 5 version)
[Rails] Where to be careful in the description of validation
[rails] Problems that cannot be registered / logged in with devise
Implement user registration function and corporate registration function separately in Rails devise