What is Mince
Mince is a ruby gem to provide a light weight ORM to persist data to a variety of databases in ruby apps.
The motivation behind this is so your application is not tightly tied to a specific database. As your application grows you may need to upgrade to a different database or pull specific models to a different persistence strategy.
Other ORMs are married to the Active Record Architecture Pattern. Although Mince can be used with the Active Record pattern as well, it is designed to be used in more of a Multitier Architecture Pattern, where the data layer is separated from the business logic layer in the application.
View the Why Multitier Architecture? page for more discussion
Currently only compatible with Ruby 1.9+. Support for Ruby 1.8 to come later.
How to use it
This library contains the core components to use Mince supported database interfaces. These interfaces can be interchanged, but in this setup example we will be using HashyDb, which is an in-memory ruby hash database.
gem install mince hashy_db
Use the config class to configure which mince database interface you desire to use:
require 'mince' require 'hashy_db' Mince::Config.interface = Mince::HashyDb::Interface
# Get the interface interface = Mince::Config.interface # Add a book interface.add 'books', title: 'The World In Photographs', publisher: 'National Geographic' # Get all books interface.find_all 'books' # Replace a book where the record's id is 1 # Use the interface's primary_key field because # some databases use non `id` fields for the primary key primary_key = interface.primary_key interface.replace 'books', primary_key => 1, title: 'A World In Photographs', publisher: 'National Geographic'
The following pages provide a deeper look into Mince
|API Docs||API docs for Mince|
|Existing Interfaces||List of supported database interfaces that can be used with Mince|
|Mince Migrator||Database migrations library for Mince|
|Usage with Rails||More information on how to use Mince with Rails|
|Fancy Mixins||We've written a few mixins that provide some standard behavior to your models while using Mince|
|Development||Help by contributing|
|Mailing List||Mailing list for Mince|
|Travis CI||Check out the build status of Mince|
|Why Multitier Architecture?||Discussion about why to use multi tier architecture as apposed to others, such as Active Record|
You can contribute to Mince by doing a number of things. View the Development page for more details.
|Matt Simpson (owner & maintainer)||@railsgrammer||@coffeencoke|
|Ionic Mobile Team||@asynchrony||@ionicmobile|
If you've been missed on this list, let us know by creating an issue or sending one of us a message.
Copyright 2013 Matt Simpson
MIT - view LICENSE.txt in the source for details
Looking for support for Version 1? Put an issue in, or send one of us a message.