Use an Entity Diagram to Draft a Data Model for a Rails App, Part 1: Overview and Users Table

Опубликовано: 28 Январь 2025
на канале: Stateless Code
70
1

Use an Entity Diagram to Draft a Data Model for a Rails App, Part 1: Overview and Users Table

No coding (yet) in this video. Instead, we take some time to think about our data data design before we dive in and start coding the features of our app.

In the video we use draw.io, a formerly open-source freeware diagramming application available on both desktop and web to design what our data model might look like. For this, we will use an entity diagram. This is a commonly used visual representation of a data model for databases. It allows you to show which tables you will have, what fields there will be, and how they will relate to one another.

In the video we review how these entity relations work in Ruby on Rails by taking a look at the guides and the app from the Getting Started with Rails 7 playlist.

As noted in the Why Rails in the 2020s? video (linked below), Rails is agile and very adaptable if you find the need to pivot in the middle of development. Even so, the amount of required rework is much lower if you are erasing or modifying a box on a white board or modifying a draw.io diagram.

We finish the video by taking the users table we already have in place from our Devise videos and bringing it into our entity diagram.

This video covers:
00:00:00 Introduction, plan for this video and the next one
00:02:36 Review of Object Relational Mapping in Rails and Active Record models and migrations
00:09:24 Why not just use `rails generate scaffold` for all of these. We want to be able to iterate and modify quickly.
00:13:54 It won't be perfect and that's okay. Just as much an art as a science.
00:15:14 Create a branch on the profile repo to store and save the entity diagram and create a new diagram
00:18:40 Represent the existing users table in the entity diagram
00:26:28 Plan for part 2 of entity diagramming

#ruby #rails7 #rails #rubyonrails #rubygems #codecast #screencast #github #opensource #minitest #TDD #agile #NerdDice #DnD #roleplaying #softwaredevelopment #learntocode #tailwind #postgresql #rubocop #devise #turbo #controllers #views #activerecord #migrations #entitydiagram #datamodeling #orm #drawio

See other related StatelessCode videos:
Getting Started with Rails 7 Playlist    • Getting Started with Rails 7  
Why Rails in the 2020s?    • Why Rails in the 2020s?  
Why Leave Mistakes in the Videos    • Why Leave Mistakes in the Videos?  
Create a RubyGem 36: Object-Oriented Dice    • Codecast: Create a RubyGem 36: Object...  

Resources that we relied upon for this solution:
Rails Guides (particularly Active Record Basics and Active Record Migrations) https://guides.rubyonrails.org
draw.io https://app.diagrams.net

Commit with entity diagram:
https://github.com/statelesscode/stat...

This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.


Смотрите видео Use an Entity Diagram to Draft a Data Model for a Rails App, Part 1: Overview and Users Table онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Stateless Code 28 Январь 2025, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 70 раз и оно понравилось 1 людям.