aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/plugin.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-02-02 20:05:26 +0100
committerJosé Valim <jose.valim@gmail.com>2010-02-02 20:05:26 +0100
commit781d0a9baef77a1d749bc8d7ea1b8e550a13c34a (patch)
treecbc7b1f2f6ef5c93d53d8580a696e47e5d59116c /railties/lib/rails/plugin.rb
parent12f595b130c31d2377531c74fc2a0b6f55a95936 (diff)
downloadrails-781d0a9baef77a1d749bc8d7ea1b8e550a13c34a.tar.gz
rails-781d0a9baef77a1d749bc8d7ea1b8e550a13c34a.tar.bz2
rails-781d0a9baef77a1d749bc8d7ea1b8e550a13c34a.zip
Add docs for Railtie, Engine, Plugin and Application.
Diffstat (limited to 'railties/lib/rails/plugin.rb')
-rw-r--r--railties/lib/rails/plugin.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index 64d03e7599..2a746e0fa6 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -1,6 +1,21 @@
require 'rails/engine'
module Rails
+ # Rails::Plugin is nothing more than a Rails::Engine, but since it's loaded too late
+ # in the boot process, it does not have the same configuration powers as a bare
+ # Rails::Engine.
+ #
+ # Opposite to Rails::Railtie and Rails::Engine, you are not supposed to inherit from
+ # Rails::Plugin. Rails::Plugin is automatically configured to be an engine by simply
+ # placing inside vendor/plugins. Since this is done automatically, you actually cannot
+ # declare a Rails::Engine inside your Plugin, otherwise it would cause the same files
+ # to be loaded twice. This means that if you want to ship an Engine as gem it cannot
+ # be used as plugin and vice-versa.
+ #
+ # Besides this conceptual difference, the only difference between Rails::Engine and
+ # Rails::Plugin is that plugins automatically load the file "init.rb" at the plugin
+ # root during the boot process.
+ #
class Plugin < Engine
def self.inherited(base)
raise "You cannot inherit from Rails::Plugin"