tag:mongrel,2007:Post37

Bringing Merb's provides/display into Rails 3

The flow of Merb ideas into Rails 3 is already under way. Let me walk you through one of the first examples that I've been working on the design for. Merb has a feature related to Rails' respond_to structure that works for the generic cases where you have a single object or collection that you want to respond with in different formats. Here's an example:

class Users < Application

provides :xml, :json

def index
@users = User.all
display @users
end
end

Syndicate content