Merb Web Application Framework APIs, Tutorials and more...

Merb is a light-weight MVC web application framework written in Ruby.

If you have any questions or if you can't figure something out, please take a look at the project page, feel free to come chat at irc.freenode.net, channel #merb, or post to merb mailing list on Google Groups.

How do I install Merb?

$ sudo gem install merb

What next?

Merb includes a "magic" generator called merb-gen. It will allow you to generate components for your application or entirely new applications.

Creating a new application

$ merb-gen app my_blog

This will create the basic application structure and configuration. You can get straight to coding!

Creating a RESTful resource

First and foremost cd into your application folder.

$ cd my_blog

You can use merb-gen to create a RESTful resource. The command will create a model (/app/models/article.rb), controller (/app/controllers/articles.rb with all the CRUD) and some views

$ merb-gen resource entry title:string,content:text

Creating a database

I just love creating new databases, inserting tables and creating the schema. Don't you wish there was an easier way to do that? There is...

$ rake db:automigrate

Done! That was easy.

How do I run my Merb Application?

Start Merb

$ merb

You can now access http://localhost:4000/

Have fun coding!

Awesome! Let's get going...

Comments