Project

schemaker

0.0
No commit activity in last 3 years
No release in over 3 years
Configures relationships between subject, join and object model for a given behavior
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 3.0.1
>= 0
>= 1.6
>= 0
>= 2.6.0
>= 0

Runtime

>= 0.1.1
 Project Readme

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.

Install

Gemfile:

gem 'schemaker

$ bundle

Usage

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

require 'schemaker'  
  
models = Schemaker::Models.new UserAccount, Role, UsersRoles, :subject_key => :troles
models.configure

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

Contributing to schemaker

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet
  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

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