67 %
33 %
Information about Merb

Published on May 20, 2007

Author: vishnu



By Luke Francl (
Presented at the Ruby Users of Minnesota, March 27, 2007.

Merb and why you potentially should care By Luke Francl ( Presented at the Ruby Users of Minnesota, March 27, 2007.

Merb = Mongrel + ERB By Ezra Zygmuntowicz Merb = Mongrel + ERB, written by Ezra Zygmunotgonna happen. When I heard Merb was Mongrel+ERB, I thought “Ah, PHP is making a comeback.” But Merb is actually a small MVC framework similar to Rails in many ways. Key points about Merb

Merb is thread-safe Merb does not use ActionPack (Rails controller/view), which is the main oender. Note: Ruby uses quot;green threadsquot;, so I believe a that to take advantage of a multi-core computer, you will need to start one Ruby instace per processor core.

Merb uses Erubis for embedded Ruby Merb uses Erubis for ERB - 3x faster than ERB - 10% faster that eRuby (written in C)

Merb does not use CGI.rb

Request Apache 2.2 mod_proxy_balancer Mongrel buffers the Mongrel upload. Rails blocks while processing the request. Rails CGI.rb causes CPU spike. It is *NOT TRUE* that Mongrel blocks while you are uploading a file. Rails blocks while you are *processing* the file.

[File] upload doesn't block Rails actions going on, when you finally pass this to Rails you'll block that Mongrel process while cgi.rb is going. This is why you should make a separate Mongrel handler to do all of your upload processing and file preparation before you pass the fully cooked stuff to Rails. Mongrel running cgi.rb in a thread is much more efficient than Rails running cgi.rb inside a lock. - Zed Shaw So, if your app has to deal with the uploads of a lot of large files which you need to do processing on, a custom upload handler will save your butt. upload

Request Apache 2.2 mod_proxy_balancer Mongrel buffers the Mongrel upload. Merb does not block. CGI.rb is Merb not used. This is why you should care about Merb -- if you need the capacity. Think of it as a custom Mongrel file handler...that you don’t have to write.

Installing Merb sudo gem install mongrel json erubis archive-tar-minitar rspec -y svn co merb && cd merb && rake install Then you can generate a new merb app: merb -g myapp Merb is available as a gem, but it is rather rough right now. I recommend getting the trunk to keep abreast of the latest bug fixes. There is a simple blogging application called MrBlog that will show you how Merb works.

Merb vs Rails Merb uses ActiveRecord, so all your favorite features are there. It’s M/V/C, so development is similar. - generator scripts are not generally available - routing is dierent (simple but functional) - not many view helpers - most configuration in Ruby rather than YAML - In general, rougher around the edges. (Example: multipart form uploads were broken)

Merb + Rails Perhaps more interesting is getting Merb working _with_ your existing Rails app. In about half a days work, I was able to get Merb loading up my ActiveRecord objects from my rails project (to avoid code duplication), and get a Rails AR plugin working. Merb can piggy-back on your Rails sessions as long as you store them in the database.

class Item < ActiveRecord::Base end require DIST_ROOT + '/../../app/models/item.rb'

Many ActiveRecord plugins will work with Merb ...with a little modification. I got Rick Olson’s attachment_fu plugin working with Merb with a few tweaks to the code. Mostly I had to change how files were required, because Rails does a lot of magic to load plugins. In this way, you can use Rails for your views and general app, and pass o file upload POST actions to Merb for LET’S LOOK AT A SHORT DEMO.

Resources Merb Docs: Merb Trac: Ezra’s blog: Erubis:

Add a comment

Related pages

MERB - Mittelbadische Entsorgungs- und Recyclingbetriebe ...

Die MERB stellt sich vor - Es freut uns, daß Sie sich die Zeit nehmen, uns näher kennenzulernen, schließlich ist unser Unternehmen schon seit 1963 ein ...
Read more

Hier sollte eine Beschreibung angezeigt werden, diese Seite lässt dies jedoch nicht zu.
Read more

The Merb Way (Addison-Wesley Professional Ruby Series ...

The Merb Way (Addison-Wesley Professional Ruby Series) eBook: Foy Savas: Kindle-Shop
Read more

Merb - Wikipedia

Merb was a model–view–controller web framework in Ruby, notable as a precursor to Rails 3. It brought increased focus on speed and modularity to Rails 3.
Read more

Merb - Mittelbadische Entsorgungs-Recyclingbetriebe GmbH ...

Merb - Mittelbadische Entsorgungs-Recyclingbetriebe GmbH, Neulandstr. 9 in Achern, Telefon 07841/6870 mit Öffnungszeiten und Anfahrtsplan
Read more

The Merb Way Buch jetzt portofrei bei bestellen

Bücher bei Weltbild: Jetzt The Merb Way versandkostenfrei online kaufen & per Rechnung bezahlen bei Weltbild, Ihrem Bücher-Spezialisten!
Read more

Unsere Behältergrößen - Eigenbetrieb Abfallwirtschaft ...

MERB - Frau Kuch : 07841 687-95 : . Abfallbehälter von 35 bis 240 Liter . Breite (B), Tiefe (T), Höhe (H) 35 Liter
Read more

Züblin Timber - Willkommen

Oder: Erfolg entsteht im Miteinander. ZÜBLIN Timber steht für anspruchsvolle und zukunftsweisende Lösungen im Holzingenieurbau. Aus einer Hand bieten ...
Read more

Ulf Merbold – Wikipedia

Ulf Merbold; Land (Organisation): Deutschland (DLR/ESA) Datum der Auswahl: 18. Mai 1978: Anzahl der Raumflüge: 3: Start erster Raumflug: 28. November 1983
Read more

Züblin Timber - STRUKTUR

Wir sind ein führendes Unternehmen für anspruchsvolle und zukunftsweisende Lösungen im Holzingenieurbau. Unsere Stärke liegt in der verlässlichen und ...
Read more