Get more from Ruby on Rails ActiveRecord and leverage shortcuts and techniques to make database code more efficient.
Overview
Syllabus
Introduction
- Welcome
- How to use the exercise files
- Create a database
- Migration shortcuts
- The change method
- Write reversible code
- Irreversible migrations
- Revert migrations
- Create a join table
- Control migration output
- Dump the database schema
- Define seed data
- Create records with a block
- Update multiple records
- Delete multiple records
- Touch records
- Toggle attribute values
- Increment and decrement counters
- Track changes to objects
- Track changes to attributes
- Restore attributes
- Other find methods
- Select partial record data
- Calculations
- Negative queries
- Or queries
- Retrieve records in batches
- Default scopes
- Replace scopes and conditions
- Join tables
- Distinct records
- Left join tables
- Eager loading
- Delegate attributes
- Set a prefix
- Without a related object
- Callback basics
- Conditional callbacks
- Around callbacks
- Other callbacks and tips
- Review
- Use queries with associations
- Destroy associated records
- Touch associated records
- Counter caches
- Build records on an association
- Self-referential associations
- Single table inheritance
- Polymorphic associations
- Next steps
Taught by
Kevin Skoglund