Codecast: Getting Started with Rails 7 03: Autoloading, Generate and Migrate a Model
Channel: Stateless Code
Date: 2021-12-21

This is the 3rd video in the Getting Started with Rails 7 series. In this video Mike reviews the Autoloading section of the Getting Started with Rails guide and compares it to the NerdDice RubyGem project. Then he creates the Article model and explores the resulting migration, the errors that occur when you have a pending migration and how to rollback a migration.

This video covers:
00:00:10 Introduction
00:00:58 Autoloading in Rails compared to requiring in other Ruby projects
00:05:08 Generate the Article model
00:08:07 Review the generated migration file
00:10:12 Demonstrate ActiveRecord::PendingMigrationError
00:11:29 Run the create_articles migration and look at the schema.rb file
00:13:24 Rollback and re-run the migration to demonstrate what happens in schema and in application
00:15:07 Discussion of alternatives for migrations (self.up, self.down, ActiveRecord::IrreversibleMigration)
00:16:27 Discussion of the value of Rails migrations compared to issuing the SQL commands in the database itself

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.