active-record-associations
OfficialMaster Rails model relationships.
AuthorThinkOodle
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill provides expert guidance for defining, using, and troubleshooting associations between Active Record models in Ruby on Rails applications, ensuring data integrity and efficient querying.
Core Features & Use Cases
- Define Relationships: Set up one-to-one, one-to-many, many-to-many, and polymorphic associations.
- Optimize Queries: Prevent N+1 query problems using eager loading techniques (
includes,preload,eager_load). - Ensure Data Integrity: Implement
dependent:options, database foreign keys, and unique constraints. - Use Case: When building an e-commerce platform, you need to define how
Products belong toCategoryies and howOrders contain multipleOrderItems, ensuring that deleting aCategorydoesn't leave orphanedProducts.
Quick Start
Use the active-record-associations skill to define a has_many :books association on the Author model and a belongs_to :author association on the Book model, including a dependent: :destroy option and a database foreign key.
Dependency Matrix
Required Modules
None requiredComponents
scriptsreferences
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: active-record-associations Download link: https://github.com/ThinkOodle/rails-skills/archive/main.zip#active-record-associations Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.