aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides/source/creating_plugins/index.txt
blob: 5d10fa4f3111628caf7df1f7bfbbd72c73bd4be8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
The Basics of Creating Rails Plugins
====================================

A Rails plugin is either an extension or a modification of the core framework. Plugins provide:

 * a way for developers to share bleeding-edge ideas without hurting the stable code base
 * a segmented architecture so that units of code can be fixed or updated on their own release schedule
 * an outlet for the core developers so that they don’t have to include every cool new feature under the sun

After reading this guide you should be familiar with:
 
 * Creating a plugin from scratch
 * Writing and running tests for the plugin
 * Storing models, views, controllers, helpers and even other plugins in your plugins
 * Writing generators
 * Writing custom Rake tasks in your plugin
 * Generating RDoc documentation for your plugin
 * Avoiding common pitfalls with 'init.rb'

This guide describes how to build a test-driven plugin that will:

 * Extend core ruby classes like Hash and String
 * Add methods to ActiveRecord::Base in the tradition of the 'acts_as' plugins
 * Add a view helper that can be used in erb templates
 * Add a new generator that will generate a migration
 * Add a custom generator command
 * A custom route method that can be used in routes.rb

For the purpose of this guide pretend for a moment that you are an avid bird watcher.  Your favorite bird is the Yaffle, and you want to create a plugin that allows other developers to share in the Yaffle goodness.  First, you need to get setup for development.


include::setup.txt[]

include::tests.txt[]

include::core_ext.txt[]

include::acts_as_yaffle.txt[]

include::models.txt[]

include::controllers.txt[]

include::helpers.txt[]

include::routes.txt[]

include::generators.txt[]

include::generator_commands.txt[]

include::migrations.txt[]

include::odds_and_ends.txt[]

include::appendix.txt[]