Vixiom Axioms

June 27, 2007

I heart Merb

Filed under: Flash, Flex, Merb, Ruby Alastair @ 10:53 pm

Yes every new framework sets my heart a flutter, but this time it’s for real.

Developing Flex/Flash on top of Rails? What if you could get ActiveRecord and RESTful routing at almost eight times the speed with 75% less RAM? How about all that and real concurrency, including true multiple file upload? All of the above without the Rails attitude? You need to get you some Merb.

Models look the same:

class Photo < ActiveRecord::Base
  belongs_to :photo_roll
  acts_as_list :scope => :photo_roll

  def to_json
    self.attributes.to_json
  end
end

Controllers look the same:

class PhotoRolls < Application

  def index
    @photo_rolls = PhotoRoll.find(:all)
    render :js => @photo_rolls.to_json
  end

end

Then consume away in Flex…

public function find() : void
        {
            var svc:JSONRESTService = new JSONRESTService();
            svc.url = /photo_rolls
            svc.sendRESTfully( index, null, onResult, onFault );
        }

That’s a custom JSON REST Service which will be showing up in a future tutorial.

or use HAML as a built in templating engine for all your HTML needs.

Merb!
Merb Docs!
Merb Tutorial!

Digg! submit I heart Merb to stumbleupon.com submit I heart Merb to del.icio.us submit I heart Merb to reddit.com Like this post? subscribe to the feed.

2 Comments »

  1. Very insightful. I was initially turned off by Merb because of the absence of all of the view helpers, but if your view is Flex, who cares? I’ll definitely be taking a look at Merb.

    Comment by Meekish — June 28, 2007 @ 9:29 am

  2. I rewrote my blog in Merb and I love the experience. If you code your Javascript unobtrusively with Prototype.js and LowPro, you won’t miss Rails’ Javascript Helpers. We’ve got a simple but functional set of form helpers into Merb.

    You can still do respond_to and send Javascript back in response to Ajax calls.

    And it’s super fast, both in development and production mode.

    Comment by topfunky — June 28, 2007 @ 11:59 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image

Powered by WordPress