Natto is a simple rails-engine based CMS system.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Natto CMS

This is the 4th incarnation, and 2nd Ruby on Rails version, of the content management system used by Dan and Dave Nawara. This time, however, we're taking it a little more serious. We're also pimpin' it out in Rails 2.x, so get ready for easy CMS goodness.

This is simply the CMS core; to get more functionality, look around for plugins.


Please make your rails app as normal.

$ rails your_app
$ cd your_app

Next, install Natto as a plugin.

$ cd vendor/plugins
$ git clone

Alternately, you could install Natto (and all of your plugins) as a git submodule.

$ git submodule add vendor/plugins/natto

Natto also requires the following plugins installed:

Engines                  git://
acts_as_tree             git://
acts_as_state_machine    git://
attachment_fu            git://
mimetype-fu              git://

The following commands will help you install these plugins as git submodules:

git submodule add git:// vendor/plugins/engines
git submodule add git:// vendor/plugins/acts_as_tree
git submodule add git:// vendor/plugins/acts_as_state_machine
git submodule add git:// vendor/plugins/attachment_fu
git submodule add git:// vendor/plugins/mimetype-fu

Please also install these as gems/plugins:

mattetti-googlecharts    git://
Ya2YAML                  git://
haml/sass                git://

After installing haml, please make sure and install it into your application:

$ haml --rails /path/to/your/application

Set up the plugin routes, by editing your application's routes.rb file and adding this line to the very top of the file:

map.from_plugin :natto

This will load the routes from RAILS_ROOT/vendor/plugins/natto/routes.rb. If you end up with routing issues down the road, make sure you don't have conflicts with this file.

At the bottom of your RAILS_ROOT/config/routes.rb, we need to set the root route to go to the home page defined in the Natto system (we will bootstrap one below). Make sure the bottom of your file looks like this:

# Install the default routes as the lowest priority.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

# Add the root route here
map.root :controller => 'pages', :action => 'home'

Next, add this line just below the rails boot line in your config/environment.rb file:

require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')

Go into the Natto plugin directory, and run the install script. This will create a backups folder, remove some of the files which the rails command generates, and copy over configuration files.

$ cd vendor/plugins/natto
$ ruby install.rb

The install also generates your site keys, which help to better secure your encrypted passwords. If you would like to use your own site keys settings, please make the changes before you run the bootstrap command. Note the generated site_keys.rb file looks a lot like the ones from the restful_authentication plugin. I basically copied their code for the authentication system (thanks, gang!).

Specifically, install.rb deletes the following (go ahead and just do it manually, if you like):


It also copies the following from the plugin directory to your application's configuration:


You can now build and populate the system's database. This will create a default administrative user for you with the following credentials:

Username: admin
Password: admin

Please change this password, or make a new administrative user and delete this one, upon your first login.

Please note again that encrypted passwords are dependent on your site keys being properly set up. (Run the install.rb file before you do this!) Your database should not have any pre-existing data when you run this command.

$ script/generate plugin_migration
$ rake db:migrate
$ rake natto:bootstrap

There is also a command to reset the users table (deleting everyone registered) in order to reset the administrator password. This is obviously dangerous in production, but can be useful while in development.

$ rake natto:bootstrap_admin

You may wish to set some configuration variables in your environment files. The Natto module declares the following variables:

Natto.site_title            = "Natto CMS"                  = "localhost:3000"
Natto.tango_home            = "/plugin_assets/natto/images/tango-icon-theme/"
Natto.max_violation_votes   = 3

You will most likely end up overriding the first two variables. The host variable should most likely get overridden inside each environments/*.rb file.

The max_violation_votes variable determines how many votes declaring a comment as a violation cause it to be hidden.

Do not directly edit any files in the Natto plugin, or you will break your system if you update!

If you want to use your own version of a controller or helper, I recommend that you copy the one from the Natto plugin, or better yet, extend it. Also, remember that you can copy views to your main application and then edit those in place.