Stefan Tilkov's Random Stuff

RESTful Rails

How did I miss this one back in November? This article by Matt Biddulph explains how to expose your Ruby on Rails model classes as RESTful resources — using Ruby’s metaprogramming support, you end up with adding one line for each resource:

class NewsController < ApplicationController
    rest_resource :item
    rest_resource :category
end

Very cool.

Comments