1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] Update plugins.md

Highlighted code.
This commit is contained in:
Harshad Sabne 2013-09-14 17:56:08 +05:30
parent e64b8c605e
commit 3988dcc4eb

View file

@ -15,7 +15,7 @@ After reading this guide, you will know:
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 methods to `ActiveRecord::Base` in the tradition of the `acts_as` plugins.
* Give you information about where to put generators in your plugin.
For the purpose of this guide pretend for a moment that you are an avid bird watcher.
@ -126,8 +126,8 @@ $ rails console
Add an "acts_as" Method to Active Record
----------------------------------------
A common pattern in plugins is to add a method called 'acts_as_something' to models. In this case, you
want to write a method called 'acts_as_yaffle' that adds a 'squawk' method to your Active Record models.
A common pattern in plugins is to add a method called `acts_as_something` to models. In this case, you
want to write a method called `acts_as_yaffle` that adds a `squawk` method to your Active Record models.
To begin, set up your files so that you have:
@ -162,9 +162,9 @@ end
### Add a Class Method
This plugin will expect that you've added a method to your model named 'last_squawk'. However, the
plugin users might have already defined a method on their model named 'last_squawk' that they use
for something else. This plugin will allow the name to be changed by adding a class method called 'yaffle_text_field'.
This plugin will expect that you've added a method to your model named `last_squawk`. However, the
plugin users might have already defined a method on their model named `last_squawk` that they use
for something else. This plugin will allow the name to be changed by adding a class method called `yaffle_text_field`.
To start out, write a failing test that shows the behavior you'd like: