Tenacity
Tenacity is a ruby gem that provides a database client independent way of managing relationships between models backed by different databases.
It is sometimes necessary, or advantageous, to use more than one database in a given application (polyglot persistence). However, most database clients do not support inter-database relationships. And, those that do support inter-database relationships only know how to work with the non-relational databases in a generic way. MongoMapper is great for working with MongoDB, as CouchRest is great for working with CouchDB. It would be a shame not be able to use great tools like these when working with their respective databases. Therefore, Tenacity’s goal is to provide simple object relationship management, while allowing you to use the database clients of your choice.
While supporting such relationships isn’t difficult, it can add quite a bit of boilerplate code to your project. And, the amount of boilerplate code increases the more complex the relationship becomes, especially when you consider that you cannot use foreign keys to maintain the integrity of your data. For example, what should happen to a child object if its parent is deleted? Should the delete be allowed to proceed? If so, should the child object be deleted as well, or just have its property linking it back to the deleted parent nullified? Tenacity aims to provide a simple and standard way to specify the behavior of these inter-database relationships.
Tenacity is heavily based on ActiveRecord’s associations, and aims to behave in much the same way, supporting many of the same options.
Example
Source code
https://github.com/jwood/tenacity
Documentation
http://rdoc.info/github/jwood/tenacity/master/frames
Download
gem install tenacity
GitHub
Most Popular Posts
Tags
Archives
- May 2012 (1)
- April 2012 (1)
- March 2012 (1)
- February 2012 (1)
- December 2011 (1)
- September 2011 (1)
- July 2011 (1)
- May 2011 (1)
- April 2011 (1)
- March 2011 (1)
- January 2011 (2)
- November 2010 (2)
- September 2010 (1)
- August 2010 (1)
- July 2010 (2)
- June 2010 (2)
- April 2010 (1)
- March 2010 (1)
- February 2010 (2)
- January 2010 (1)
- December 2009 (1)
- November 2009 (1)
- September 2009 (2)
- August 2009 (3)
- July 2009 (2)
- June 2009 (3)
- April 2009 (1)
- February 2009 (1)
- January 2009 (2)
- December 2008 (8)
- November 2008 (2)
- October 2008 (3)
- September 2008 (6)
- July 2008 (3)
- June 2008 (1)
- May 2008 (8)
- April 2008 (6)
- March 2008 (2)
Blogroll
Industury News
Other Links
My GitHub Feed
- jwood pushed to master at signal/signal-ruby
- jwood pushed to master at signal/proby
- jwood pushed to master at signal/proby
- jwood pushed to master at signal/signal-ruby
- jwood pushed to master at signal/proby
- jwood pushed to master at signal/signal-ruby
- jwood pushed to master at signal/signal-ruby
- jwood pushed to master at signal/proby-ruby
- jwood commented on pull request 9 on stripe/stripe-ruby
- jwood pushed to master at signal/proby





