Create My Page with Rails devise

Thing you want to do

Make an article about creating my page using devise, which is a gem of rails.

** Assumption: Rails environment built, devise installed **

route settings

Create a show action to create my page.

# routes.rb
resources :user, only: [:show]

Creating a controller

Create a user controller.

$ rails g controller users show

Editing controller

Get the user who is the DB in users_controller.

# app/controllers/users_controller.rb
  #My page
  def show
    @user = User.find(params[:id])
  end

Edit view

Create a view of my page. Show nickname and email address in user table

# views/users/show.html.haml
%h1
  = @user.nickname
%h1
  = @user.email

Finally

I wrote an article about creating my page with devise easily. I want to output little by little and acquire skills, and I hope it will be useful to someone. It was my first post, but it was fun as a markup practice. I will continue to post.

Recommended Posts

Create My Page with Rails devise
Handle devise with Rails
Create portfolio with rails + postgres sql
Create pagination function with Rails Kaminari
[Rails] devise
[Rails6] Create a new app with Rails [Beginner]
Create Rails 6 + MySQL environment with Docker compose
[Rails withdrawal] Create a simple withdrawal function with rails
[Rails 5] Create a new app with Rails [Beginner]
[Rails] Introducing devise
rails + devise + devise_token_auth
[Rails] rails new to create a database with PostgreSQL
Create a team chat with Rails Action Cable
Determine the current page with Ruby on Rails
Create an EC site with Rails 5 ⑩ ~ Create an order function ~
Try create with Trailblazer
Create an EC site with Rails5 ⑦ ~ Address, Genre model ~
[Rails] devise helper method
Create an EC site with Rails 5 ⑨ ~ Create a cart function ~
[Rails] Customize devise validation
[My memo] Let's get along with Pry / DB with Rails
Rails deploy with Docker
How to make an almost static page with rails
Create an EC site with Rails5 ④ ~ Header and footer ~
[Rails] Learning with Rails tutorial
Create an EC site with Rails5 ⑥ ~ seed data input ~
[Rails] Test with RSpec
[Rails] Development with MySQL
[Rails] devise introduction method
[Rails] Initial setting of user-created login with devise, devise_token_auth
Supports multilingualization with Rails!
[Rails] Create initial data with seed.rb [Faker] [Japanese localization]
[Rails] Create an application
[rails] About devise defaults
Double polymorphic with Rails
Implement devise edit page
Tutorial to create a blog with Rails for beginners Part 1
Create a page control that can be used with RecyclerView
[Rails] I tried to create a mini app with FullCalendar
I was addicted to setting default_url_options with Rails devise introduction
[Rails] Create an email sending function with ActionMailer (complete version)
[Rails] Create API to download files with Active Storage [S3]
A series of steps to create portfolio deliverables with Rails
Create Rails5 and postgresql environment with Docker and make pgadmin available
[rails] Problems that cannot be registered / logged in with devise
Tutorial to create a blog with Rails for beginners Part 0
[Rails] Introduction of devise Basics
Create XML-RPC API with Wicket
Introduced graph function with rails
[Rails] Express polymorphic with graphql-ruby
What is Rails gem devise?
[Rails] Upload videos with Rails (ActiveStorage)
Try using view_component with rails
[Rails] gem devise installation flow
[Rails] How to install devise
Japaneseize using i18n with Rails
API creation with Rails + GraphQL
Preparation for developing with Rails
Create a playground with Xcode 12
(For beginners) [Rails] Install Devise
Run Rails whenever with docker