h1. Schemaker

This is the *Schema Maker* also known as the schemaker. This gem can help configure your model relationships for 3 models, the subject, the join and the object model. Typically when you add some behavior field to a subject (fx a UserAccount model class), this may require a 1-M or M-M relationship to the object of that relationship. With ActiveRecord this can require a join model or just a symmetrical :has_and_belongs_to_many. If you apply Schemaker, it will handle all this magic for you!

Schemaker is intended for use when creating gems that require somewhat complex model relationships for adding behavior. It does the “heavy lifting” on this part of the work. There will likely be adapters for other data stores too, to simplify ensuring that your gem can support and store the relationships correctly for these data stores.

h2. Install

Gemfile:

@gem ‘schemaker@

@$ bundle@

h2. Usage

Create a complex Many-to-Many join through the join model

<pre>require ‘schemaker’

models = Schemaker::Models.new UserAccount, Role, UsersRoles, :subject_key => :troles models.configure</pre>

Create a “quick join” (a symmetrical :has_and_belongs_to_many for the subject and object model)

@models.subject_model.quick_join@

Create a :has_one to relationship from the subject to the object

@models.subject_model.create_has_one :object@

h2. Contributing to schemaker

h2. Copyright

Copyright © 2011 Kristian Mandrup. See LICENSE.txt for further details.