Ruby on Rails 6 Essential Training: Models and Associations
2h 15mBeginner2020-10-15
Authors

Kevin Skoglund
Founder of NovaFabrica
Course details
Ruby on Rails can speed up and improve your development of full-featured web applications because it provides powerful tools that give structure and automate common data tasks. In this course, learn about the built-in features of models and associations in Rails. Apply named scopes, validations, callbacks, and associations to a sample project. Find out how to build smarter models by adding attributes not in the database and leveraging efficient queries. Walk through the use of available validation methods and helpers. Learn how to implement custom validations and to write and add automatic actions, known as callbacks. Explore effective use of Active Record associations, investigate belongs-to-many relationships and rich associations, and learn how to write queries that span several tables.
Skills covered
Ruby on RailsBack-End Web DevelopmentFull-Stack Web DevelopmentEssential TrainingWeb DevelopmentOpen Source
Concepts
0. Introduction
- 01 - Let ActiveRecord objects manage your data
- 02 - What you should know
- 03 - Using the exercise files on GitHub
1. Smarter Models
- 04 - Non-database attributes
- 05 - Smart models by design
- 06 - More ActiveRecord query methods
- 07 - Query data selection
- 08 - Named scopes
- 09 - Challenge - Named scopes
- 10 - Solution - Named scopes
2. Data Validations
- 11 - Overview of validation methods
- 12 - Write validations
- 13 - Use the multipurpose validates method
- 14 - Write custom validations
- 15 - How to skip validations
- 16 - Challenge - Validations
- 17 - Solution - Validations
3. ActiveRecord Callbacks
- 18 - Overview of callbacks
- 19 - Use callbacks to automate actions
- 20 - Execute callbacks conditionally
- 21 - How to skip callbacks
- 22 - Challenge - Callbacks
- 23 - Solution - Callbacks
4. ActiveRecord Associations
- 24 - Work with associations
- 25 - Validate presence with belongs to
- 26 - Destroy dependent-related records
- 27 - Has and belongs to many relationships
- 28 - Rich join associations
- 29 - Traversing a rich join association
- 30 - Joining tables during queries
Conclusion
- 31 - Next steps