include vs extend in Ruby: Clear Rules, Real Patterns
Understand exactly how include and extend work in Ruby, with method lookup rules, common mistakes, and production patterns.
Topic index generated on 2026-08-03 — grouped article list
Below is an index of articles grouped by topic. Click a heading to jump to the section.
If you find missing articles or inaccurate groupings, run ./scripts/update_index.py with appropriate flags.
Understand exactly how include and extend work in Ruby, with method lookup rules, common mistakes, and production patterns.
Complete guide to Ruby method arguments — positional parameters, default values, variable args with splat, keyword arguments, forwardable args, and common pitfalls.
A comprehensive guide to define_attribute_methods in Rails - generating attribute accessors, mutators, and query methods dynamically for ActiveRecord models.
Understanding autoload in Rails - how Rails automatically loads constants and modules based on directory structure and naming conventions. Covers classic autoloader and Zeitwerk.
A complete guide to Ruby's context-switching methods — instance_eval, instance_exec, class_eval, and module_exec — with practical use cases and security considerations.
A comprehensive guide to using alias and alias_method in Ruby for method aliasing, metaprogramming, code reuse, and Rails patterns.
Content Class Methods
A complete guide to Ruby's dynamic dispatch — using send, public_send, and method objects to call methods dynamically, bypass visibility, and build flexible APIs.
A complete guide to Ruby's method_missing — how it works, practical use cases, and how to implement it safely with respond_to_missing?.
A complete guide to Ruby class methods — the three ways to define them, singleton methods, inheritance, and practical patterns.
A complete guide to loops and iteration in Ruby — times, upto, each, while, until, loop, map, select, and when to use each.
A complete guide to Ruby instance methods — the three ways to define them, singleton methods, unbound methods, and dynamic method definition.
A complete guide to Ruby's include and extend — how they differ, when to use each, and the classic pattern for adding both instance and class methods via a module.
A complete guide to sessions in Rails — how they work, storage options, security considerations, and best practices for authentication.