aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source/creating_plugins/core_ext.txt
diff options
context:
space:
mode:
authorJeff Dean <jeff@zilkey.com>2008-11-17 00:15:20 -0500
committerJeff Dean <jeff@zilkey.com>2008-11-17 00:15:20 -0500
commit236142d23eb083d0a755d29d6365925ae5cc9f03 (patch)
treef12e47105127b61d02084d48146cdaeaf43b855b /railties/doc/guides/source/creating_plugins/core_ext.txt
parenteda282f85743961e2910e4e493a2690fa633b94f (diff)
downloadrails-236142d23eb083d0a755d29d6365925ae5cc9f03.tar.gz
rails-236142d23eb083d0a755d29d6365925ae5cc9f03.tar.bz2
rails-236142d23eb083d0a755d29d6365925ae5cc9f03.zip
Rails plugin: misc error fixes.
Diffstat (limited to 'railties/doc/guides/source/creating_plugins/core_ext.txt')
-rw-r--r--railties/doc/guides/source/creating_plugins/core_ext.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/doc/guides/source/creating_plugins/core_ext.txt b/railties/doc/guides/source/creating_plugins/core_ext.txt
index efef0e1f70..cbedb9eaf2 100644
--- a/railties/doc/guides/source/creating_plugins/core_ext.txt
+++ b/railties/doc/guides/source/creating_plugins/core_ext.txt
@@ -67,13 +67,13 @@ $ ./script/console
=== Working with init.rb ===
-When rails loads plugins it looks for the file named init.rb. However, when the plugin is initialized, 'init.rb' is invoked via `eval` (not `require`) so it has slightly different behavior.
+When rails loads plugins it looks for the file named 'init.rb' or 'rails/init.rb'. However, when the plugin is initialized, 'init.rb' is invoked via `eval` (not `require`) so it has slightly different behavior.
Under certain circumstances if you reopen classes or modules in 'init.rb' you may inadvertently create a new class, rather than reopening an existing class. A better alternative is to reopen the class in a different file, and require that file from `init.rb`, as shown above.
If you must reopen a class in `init.rb` you can use `module_eval` or `class_eval` to avoid any issues:
-*vendor/plugins/yaffle/init.rb*
+*vendor/plugins/yaffle/rails/init.rb*
[source, ruby]
---------------------------------------------------
@@ -86,7 +86,7 @@ end
Another way is to explicitly define the top-level module space for all modules and classes, like `::Hash`:
-*vendor/plugins/yaffle/init.rb*
+*vendor/plugins/yaffle/rails/init.rb*
[source, ruby]
---------------------------------------------------