Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

114 lines (74 sloc) 4.428 kB

Her Build Status Gem dependency status

Her is an ORM (Object Relational Mapper) that maps REST resources to Ruby objects. It is designed to build applications that are powered by a RESTful API instead of a database.


In your Gemfile, add:

gem "her"

That’s it!


First, you have to define which API your models will be bound to. For example, with Rails, you would create a new config/initializers/her.rb file with these lines:

# config/initializers/her.rb
Her::API.setup :url => "" do |connection|
  connection.use Faraday::Request::UrlEncoded
  connection.use Her::Middleware::DefaultParseJSON
  connection.use Faraday::Adapter::NetHttp

And then to add the ORM behavior to a class, you just have to include Her::Model in it:

class User
  include Her::Model

After that, using Her is very similar to many ActiveRecord-like ORMs:

# GET and return an array of User objects

# GET and return a User object

@user = User.create(:fullname => "Tobias Fünke")
# POST "" with the data and return a User object

@user = => "Tobias Fünke")
@user.occupation = "actor"
# POST with the data and return a User object

@user = User.find(1)
@user.fullname = "Lindsay Fünke"
# PUT with the data and return+update the User object

You can look into the examples directory for sample applications using Her. For a complete reference of all the methods you can use, check out the documentation.


I told myself a few months ago that it would be great to build a gem to replace Rails’ ActiveResource since it was barely maintained, lacking features and hard to extend/customize. I had built a few of these REST-powered ORMs for client projects before but I decided I wanted to write one for myself that I could release as an open-source project.

Most of Her’s core codebase was written on a Saturday morning (first commit at 7am!) while I was visiting my girlfiend’s family in Ayer’s Cliff.


See to learn how to use Faraday’s middleware to customize how Her handles HTTP requests and responses.


See to learn about Her’s advanced features.


See to learn how to test models using stubbed HTTP requests.


See the for backward compability issues.


Most projects I know that use Her are internal or private projects but here’s a list of public ones:


Yes please! Feel free to contribute and submit issues/pull requests on GitHub.

See for best practices.


These fine folks helped with Her:


Her is © 2012 Rémi Prévost and may be freely distributed under the MIT license. See the LICENSE file.

Jump to Line
Something went wrong with that request. Please try again.