Meet Merb: Ezra's MountainWest RubyConf Talk

Hear a lot about merb straight from Ezra:

I don't know about you, but this got me pretty pumped about merb.

April 11, 2008 at 13:53 Permalink Edit Destroy

Meet Merb: Action methods taking arguments

Have you ever written a controller action like:

class PostsController < ApplicationController
  def create
    @post = Post.new(params[:post])
    @post.save
  end
end

Notice how we yank something out of the request parameters? Wouldn't it be nice if you could just define that as an argument to the action method?

Well, merb-action-args does exactly that.

class Posts < Application
  def create(post)
    @post = Post.new(post)
    @post.save
  end
end

Superficially, for this example, there isn't really much of a difference. But, I do feel like it shows your intent more clearly. It basically says, "The create method takes a post."

How does it work internally? It seems to be using ParseTree voodoo.

When an action is about to be called, the method arguments are looked up. Then, for each argument is used as a key of the params hash in turn. Finally, the action is called with the appropriate arguments.

If you want to actually use it, you need to install it and add a bit to config/init.rb:

gem install -y merb-action-args

Note: this is for merb-0.9.0, which is a 'developer-only' release so it's not available from rubyforge yet. See Michael Ivey's post about how to install.

dependency "merb-action-args"

If you want to hack on merb-action-args, it's part of merb-more, which is hosted on GitHub

February 28, 2008 at 10:50 Permalink Edit Destroy

Meet Merb

Merb has been getting a good amount of attention lately as an alternative to rails. I've been playing with it a little since I've been playing around with blerb.

One thing I've discovered is that some things are a bit underdocumented, both in terms of rdoc and more generalized documentation.

As a result of this, I've decided to start a series of posts 'Meet merb', where I'll talk about some of the bits and pieces I've learned along the way.

February 28, 2008 at 10:44 Permalink Edit Destroy

More git: links 2008-02-14

I've been using git a lot more since my last set of git links.

There are hosting options available, even if you don't want to setup something up yourself. I've only used GitHub myself, so I can't speak for the others

  • GitHub: Currently in invite-beta mode (no, I don't have any more invites)
  • repo.or.cz: provides public hosting
  • Gitorious: targets open source projects

It seems like lots of Ruby projects have been switching to git recently. Here's is an example of people using and promoting development through the distributed magic of git:

February 14, 2008 at 00:42 Permalink Edit Destroy