Quick Start - noodall/noodall GitHub Wiki

Quickly setting up a Noodall website

Noodall provides a generator to quickly generate a Rails 3 app, already set up to use Noodall and MongoMapper. We assume you already have Ruby, RubyGems and MongoDB installed.

Let's get started

Install the gem

gem install noodall

Use Noodall to generate your new application

noodall my-app

You should now have a base Noodall/Rails app set up.

By default this app provides one 'Template' - a Home page - and the necessary seed data to populate it. Let's get it running.

cd my-app
rake db:seed
rails s

Now visit http://localhost:3000 and you should see the home page.

If you visit http://localhost:3000/admin and fill in the default password (in the db/seeds.rb file) you will see the home page in the CMS.

Hooray! We are in business!

But you cannot add any new pages. Boo. This is because you haven't created any node templates other than the home page. Let's do that.

Creating a Node Template

Noodall is based on the concept of Node Templates that allow you to have a different look and feel for each web page depending on which template you choose in the CMS. Node Templates are Ruby classes that extend the Noodall::Node class.

Let's create a basic page template called 'Content Page'. Noodall provides a handy Rails generator to allow us to do this. Run the following generator.

rails g noodall:template ContentPage

This generates four files, lets take a look at each.


This is the Ruby model that defines the Node Template.

class ContentPage < Noodall::Node  
  # Define which Node Templates can be used as children of Nodes using this template
  sub_templates ContentPage

  # Define the number of each component slot type this Node Template allows. Slots are defined in 'config/initializers/noodall.rb'
  # small_slots 4


This is the view file that website visitors will see whenever they view a Content page. It is a standard Rails erb file to which you can add as much html as you like.


This is the form that is used for editing Content Pages.


This is a Factory Girl factory used for testing and for generating pages using the sitemap.yml

Allow the template to be added as a root page

Now we have a template the last thing we need to do is configure Noodall to allow us to place a ContentPage at the root level of the tree.

Open the file config/initializers/noodall.rb and change the last line to the following

Noodall::Node.root_templates ContentPage

Restart the app.

Create some nodes

If we visit http://localhost:3000/admin you should now see a shiny 'New' button in the top right of the page. Hit this and create your first root node. Once you have finished creating your node and return to the list of contents you should see your new root node. If you click the plus button next to '0 Children' in the 'Sub Section' column you can add a child node. You can continue to add as many children as you like. Congratulations! You have created your first Noodall tree :)