Saturday, July 9, 2011

plugins on rails 3.0


How to install it?
rails plugin install URL
How to remove it?
rails plugin remove plugin_name
How to create your own plugin?
rails generate plugin my_plugin
The files that are required are:
init.rb
and directory in the plugin called lib

A few special variables are available to your code in init.rb:
name The name of your plugin ('my_plugin' in our simple example).
path The directory in which the plugin exists, which is useful in case you need to read or write nonstandard files in your plugin’s directory. 
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.)

No comments:

Post a Comment