MarkMapper is a community-driven Ruby Object Mapper for MarkLogic. It has all the bells and whistles you expect from ActiveRecords (validation, finders, callbacks, etc). MarkMapper helps you set up databases and application servers. Once you define your object model, MarkMapper will serialize to/from JSON for you.
MarkMapper requires MarkLogic 8 or greater. It persists all documents as JSON. Check out the Documentation for more.
Install the MarkMapper gem:
$ gem install mark_mapper
Define your models:
class User include MarkMapper::Document key :name, String key :age, Integer many :hobbies end class Hobby include MarkMapper::EmbeddedDocument key :name, String key :started, Time end
Use your models to create and find documents:
user = User.new(:name => 'Brandon') user.hobbies.build(:name => 'Programming', :started => 10.years.ago) user.save! User.where(:name => 'Brandon').first