Screen.Recording.2024-02-21.at.1.09.48.AM.mov
This Rails 7 app has two models User and Info, offering CRUD APIs and a UI driven by Hotwire with turbo-frame and turbo-streams.
Database Schema
Users table has columns
- name : string
Infos table has columns
- title : string
- email : string
- age : integer
- phone : string
- user_id : foreign_key
Defined Associations
- User has_one Info
- Info belongs_to User
First, Install ruby 3.2.2 using rbenv or rvm
rbenv install 3.2.2Install dependencies
bundle installSetup database
rails db:create
rails db:migrate
rails db:seedStart the Rails Server
rails serverBy default, it will run on http://localhost:3000
GET /users.json
GET /users/${user_id}.json
POST /users.json
PUT /users/${user_id}.json
DELETE /users/${user_id}.json GET /infos.json
GET /infos/${info_id}.json
POST /infos.json
PUT /infos/${info_id}.json
DELETE /infos/${info_id}.jsonhttps://api.postman.com/collections/21655182-7eebfb17-025d-4d19-a593-a4640a2e830e?access_key=PMAT-01HQ41D9BNR8P6WZSSQN74CFM4