Prev | Current Page 116 | Next

Brad Ediger

"Advanced Rails"

The core team cannot
and would not include everything that anybody wants in Rails.
Luckily, Rails comes with a very flexible extension system. Rails plugins allow developers
to extend or override nearly any part of the Rails framework, and share these
modifications with others in an encapsulated and reusable manner.
About Plugins
Plugin Loading
By default, plugins are loaded from directories under vendor/plugins in the Rails
application root. Should you need to change or add to these paths, the plugin_paths
configuration item contains the plugin load paths:
config.plugin_paths += [File.join(RAILS_ROOT, 'vendor', 'other_plugins')]
By default, plugins are loaded in alphabetical order; attachment_fu is loaded before
http_authentication. If the plugins have dependencies on each other, a manual loading
order can be specified with the plugins configuration element:
config.plugins = %w(prerequisite_plugin actual_plugin)
Any plugins not specified in config.plugins will not be loaded. However, if the last
plugin specified is the symbol :all, Rails will load all remaining plugins at that point.
Rails accepts either symbols or strings as plugin names here.
config.plugins = [ :prerequisite_plugin, :actual_plugin, :all ]
80 | Chapter 3: Rails Plugins
The plugin locator searches for plugins under the configured paths, recursively.
Because a recursive search is performed, you can organize plugins into directories;
for example, vendor/plugins/active_record_acts and vendor/plugins/view_extensions.


Pages:
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128