diff options
author | Zachary Scott <e@zzak.io> | 2014-12-15 18:44:59 -0800 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2014-12-15 18:44:59 -0800 |
commit | a0258d54225390c6f331569bca79c29286f60ddd (patch) | |
tree | a58c19908848764f2c75cae37d35d3911836abf6 /guides/source | |
parent | fb390df036ec8da8db542d0cd0262335e99b7089 (diff) | |
parent | 836594385214a783e122c88354223dbdf57cb789 (diff) | |
download | rails-a0258d54225390c6f331569bca79c29286f60ddd.tar.gz rails-a0258d54225390c6f331569bca79c29286f60ddd.tar.bz2 rails-a0258d54225390c6f331569bca79c29286f60ddd.zip |
Merge branch 'jonatack-patch-8' [ci skip]
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/constant_autoloading_and_reloading.md | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/guides/source/constant_autoloading_and_reloading.md b/guides/source/constant_autoloading_and_reloading.md index a6b270e06d..e024300f3a 100644 --- a/guides/source/constant_autoloading_and_reloading.md +++ b/guides/source/constant_autoloading_and_reloading.md @@ -7,7 +7,7 @@ After reading this guide, you will know: * Key aspects of Ruby constants -* What is `autoload_paths` +* The purpose of `autoload_paths` * How constant autoloading works @@ -15,6 +15,8 @@ After reading this guide, you will know: * How constant reloading works +* Why autoloading is not based on `Module#autoload` + * Solutions to common autoloading gotchas -------------------------------------------------------------------------------- @@ -225,13 +227,13 @@ constants on the fly. ### Constants are Stored in Modules Constants belong to modules in a very literal sense. Classes and modules have -a constant table, think of it as a hash table. +a constant table; think of it as a hash table. -Let's analyze an example to really understand what that means. While in a -casual setting some abuses of language are customary, the exposition is going -to be exact here for didactic purposes. +Let's analyze an example to really understand what that means. While figurative +language may be customary in a casual setting, for didactic purposes we will +be literal and precise. -Let's consider the following module definition: +Consider the following module definition: ```ruby module Colors @@ -648,7 +650,7 @@ trigger the heuristic is defined in the conflicting place. When a module acts as a namespace, Rails does not require the application to defines a file for it, a directory matching the namespace is enough. -Suppose an application has a backoffice whose controllers are stored in +Suppose an application has a back office whose controllers are stored in `app/controllers/admin`. If the `Admin` module is not yet loaded when `Admin::UsersController` is hit, Rails needs first to autoload the constant `Admin`. |