- Use Rakefile for tasks that operate on the plugin’s source files, such as special testing or documentation. These must be run from the plugin’s directory.
- Use tasks/*.rake for tasks that are part of the development or deployment of the application in which the plugin is installed. These will be shown in the output of rake ,ÄìT, the list of all Rake tasks for this application.
Saturday, July 9, 2011
class Symbol def %(arg) ... end endThe above code does what you need, but leaves no hint that you've made a change to Symbol. An alternative solution is to define a module and include that module in Symbol.
module SymbolExtension def %(arg) ... end end Symbol.send :include, SymbolExtension
Granted, this isn't a huge hint, but if you check
Symbol.ancestorsyou'll find the following list.
Symbol SymbolExtension Object Kernel
extracted from: http://blog.jayfields.com/2007/01/class-reopening-hints.html
How to install it?
rails plugin install URL
How to remove it?
rails plugin remove plugin_nameHow to create your own plugin?rails generate plugin my_pluginThe files that are required are:init.rbA few special variables are available to your code in init.rb:name The name of your plugin ('my_plugin' in our simple example).config The configuration object created in environment.rb. (See Chapter 1, “Rails Environments and Configuration,” as well as the online API docs for Rails::Configuration to learn more about what’s available via config.)