hypermodel Build Status Dependency Status

A Rails Responder that renders any Mongoid model to a JSON HAL format, suitable for Hypermedia APIs.


Put this in your Gemfile:

gem 'hypermodel'


class PostsController < ApplicationController
  respond_to :json

  def show
    @post = Post.find params[:id]
    respond_with(@post, responder: Hypermodel::Responder)

Now if you ask your API for a Post:

 "title"=>"My post",
 "body"=>"Foo bar baz.",
    [{"_id"=>"4fb648996b98c9091900000d", "body"=>"Comment 1"},
     {"_id"=>"4fb648996b98c9091900000e", "body"=>"Comment 2"}]}}


  • List of hypermodel contributors

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add specs for it. This is important so we don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. If you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull.

  • Send me a pull request. Bonus points for topic branches.


MIT License. Copyright 2012 Codegram Technologies