New Merb Tutorial and RESTful Sample Application

Posted by ezmobius Thu, 31 May 2007 08:02:00 GMT

Just a quick post here to link to a sweet merb tutorial with a nice restfull sample app by Zack Chandler

Here’s the tutorial. And here is the repo with a RESTful invoice tracker merb app

Also I just released the merb0.3.3 gem. Thanks to Dave Goodlad we now have route generation helpers as well, check it out:

$ merb -i
merb init called
irb(main):001:0> show_routes
[:edit_comment, "/posts/:post_id/comments/:id/edit"]
[:new_post, "/posts/new"]
[:posts, "/posts"]
[:custom_new_post, "/posts/new/:action"]
[:edit_post, "/posts/:id/edit"]
[:comment, "/posts/:post_id/comments/:id"]
[:post, "/posts/:id"]
[:new_comment, "/posts/:post_id/comments/new"]
[:custom_new_comment, "/posts/:post_id/comments/new/:action"]
[:comments, "/posts/:post_id/comments"]
=> nil
irb(main):002:0> url :edit_comment, :post_id => 42, :id => 24
=> "/posts/42/comments/24/edit" 
irb(main):003:0> url :posts
=> "/posts" 
irb(main):004:0> url :posts, :format => 'xml'
=> "/posts.xml" 
irb(main):005:0> url :posts, :format => 'xml'
=> "/posts.xml" 
irb(main):006:0> url :edit_comment, :post_id => 42, :id => 24, :format => 'js'
=> "/posts/42/comments/24/edit.js" 

There is one slight change in the router.rb route definition that you have to change if you are upgrading from an older merb. In dist/conf/router.rb, you need to use Merb::Router.prepare instead of Merb::RouteMatcher.prepare.


There are a lot of new little features in this release from the hackfest at Railsconf. Keep them patches coming folks

Tags  | 4 comments

Comments

  1. Dr Nic said about 5 hours later:
    Is it worth having RouteMatcher as a subclass of Router, for legacy support? And deprecate it later?
  2. topfunky said 13 days later:
    Should patches and bugfixes go on Rubyforge, or is there a Devjavu page for them?
  3. Ezra said 14 days later:
    @topfunky, there is a trac setup at devjavu http://merb.devjavu.com
  4. topfunky said 14 days later:
    Ah, found it. Thanks for the link.

(leave url/email »)

   Preview comment