RubyFlow : The Ruby Community Blog

Home   Submit   Sign Up   Log In   leaders   Twitter   RSS Feed  
 

[Experimental] Repository Pattern on top of ActiveRecord

Over the past few days I've started experimenting with the idea of implementing the repository pattern on top of ActiveRecord (yes, it sounds scary). The motivation came after we were about to kick start a relatively large scale system. It would be great to retain the powerfulness of ActiveRecord as well as making our app easier to maintain and test. It is basically a compromise, a stop gap, if you will.

I've always liked the Datamapper library but unfortunately ever since the Merb/Rails merge it has stepped outside of the spotlight. Datamapper 2 is shaping up nicely but it is still a far way away. So I decided to base my experimentation on top of utilising both ActiveRecord and Virtus, the attributes component of Datamapper 2.

You can check out what I've been doing here: https://github.com/fredwu/datamappify

It is an experiment, and it's still too early to see how useful and practical it'll become, but I'd love to get some feedback from you guys!

Comments

You can use DataMapper with Rails 3 using dm-rails.postmodern - March 17, 2013 23:58

Post a Comment

Comment abilities for non registered users are currently deactivated, pending time to add a proper CAPTCHA to solve the escalating spam problem. Sorry!