Best Practices for Naming Models in Ruby on Rails
In Ruby on Rails, naming models is more than just a convention. It's about clarity, efficiency, and ensuring your app is easy to manage. Here's a guide to help you name your models like the pros.
P.S. I created a handy guide at https://web-crunch.com/naming-models. Bookmark it if you need a refresher every once in a while!
Timestamps:
00:00 - Intro and find the new guide
01:42 - Singular and Capitalized
02:53 - Keep it descriptive and clear
03:28 - Organize with namespaces
03:59 - Intuitive Associations
04:22 - Acronyms and Initialisms
04:48 - Avoid Reserved Words
05:02 - Context-Specific Naming
05:22 - Avoid Ambiguity
06:11 - Composite Names
06:47 - Polymorphic versatility
07:43 - Single Table Inheritance
08:45 - Wrapping up
View the guide here: https://web-crunch.com/naming-models
Read the blog post here: https://web-crunch.com/posts/best-practices-for-naming-models-in-ruby-on-rails
======
👋 I'm Andy Leverenz, a passionate product designer and developer. I love creating and sharing my knowledge through design, coding, and writing. Join me on my journey by checking out my blog, Web-Crunch (https://web-crunch.com), where I publish tutorials, articles, and the occasional vlog about design and development.
📰 Never miss an update! Click here to subscribe: https://www.youtube.com/user/webcrunch?sub_confirmation=1
💻 Read the written version:
https://web-crunch.com/posts/best-practices-for-naming-models-in-ruby-on-rails
💎 New to Ruby on Rails? Enroll in my course HELLO RAILS:
https://hellorails.io
💻 The Blog (my source of truth): https://web-crunch.com
Additional Links:
🎨 Bring life to Rails projects with Rails UI: https://railsui.com.
👨💻 Hire me: Visit: https://railsui.com/custom
🐤 https://twitter.com/webcrunchblog.
⚙️ https://github.com/justalever.
P.S. This stuff takes a long time to make but I love to do it. To help me keep at it consider supporting me. If not monetarily, then subscribe to the channel or share it with someone!
✨ https://github.com/sponsors/justalever
☕️ https://www.buymeacoffee.com/webcrunch
-
9:43
Webcrunch
6 months agoHow to use Bun with Ruby on Rails
11 -
8:42
Techmaker Studio
3 years agoRails Tutorial | Using Polymorphic Associations in Ruby on Rails 6
10 -
36:08
Techmaker Studio
3 years ago $0.02 earnedRails Tutorial | Using the Entity Attribute Value Model in Ruby on Rails
31 -
11:00
Techmaker Studio
4 years agoRails Tutorial | Readable URLs with Friendly ID in Ruby on Rails 6
9 -
14:01
Techmaker Studio
3 years agoRails Tutorial | Working with Global ID in Ruby on Rails
14 -
24:03
Techmaker Studio
4 years agoRails Tutorial | Building a Blog with Ruby on Rails 6 - Part 6
-
13:02
Techmaker Studio
4 years agoRails Tutorial | Building a Blog with Ruby on Rails 6 - Part 3
16 -
21:22
Techmaker Studio
4 years agoRails Tutorial | Building a Blog with Ruby on Rails 6 - Part 7
-
12:39
Techmaker Studio
4 years agoRails Tutorial | Using View Components to Create Reusable Views in Ruby on Rails - Part 2
5 -
15:32
Techmaker Studio
4 years agoRails Tutorial | Using View Components to Create Reusable Views in Ruby on Rails
6