I have a problem: I need to store a huge set of data and access it from many different projects located in different locations. I know I’ll never have a schema and probably I have to use more than a DBMS to persist and serve this data. I have no idea about what to use but I need to be up and running asap (as usual 🙂 ).

Best choice seems to build an API between softwares and database. I can access to resources using HTTP and interact in a not-so-complex way. Unfortunately I’ll not be able to use an ORM… Or not?

Actually there are a few projects which try to implement ORM for RESTful resources. Most used solutions has its own component: ActiveRecord include ActiveResource and DataMapper has an adapter called dm-rest-adapter. IMHO Her seems to be the most promising.

It uses Faraday, a well-know, flexible and powerful HTTP adapter and supports its middlewares. Integrating into an existing model is really easy:

class User
include Her::Model
has_many :comments
has_one :role
belongs_to :company
@user = User.find(1)
@user.comments # list of comments
@user.role # user role
@user.company # user company
@user.fullname = "Bar"
User.create(fullname: "Foo")

You can embed related items into JSON response. If you don’t, Her makes the request only when you try to access to the property.

If REST actions are not enough for you, is possible to define custom actions with generic params

class User
include Her::Model
custom_get :admin
custom_post :search
User.search(name: "Foo")

or make HTTP request directly

User.get_collection(:admin) # expects a list of items as response
User.get_resource(:admin) # expects a single item as response
User.get_raw(:admin) # returns HTTP response
User.get(:admin) # auto detect get_collection or get_resource

Similar methods are available also for POST, PUT and DELETE. You can also add before and after hooks to your models that are triggered on specific actions (save, update, create, destroy).

I really like this project. Maybe is not supported like competitors and still has a lot of issues but is simple enough to grow.