No commit activity in last 3 years
No release in over 3 years
Automatically manages saving, deletion and validating the object graph
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.5.2
>= 0
>= 0
>= 0

Runtime

= 2.3.5
 Project Readme

acts-as-aggregate-root¶ ↑

Intended to make an activerecord object an ‘AggregateRoot’ meaning the root manages the lifecyle of all the objects in the ‘Aggregate’.

The whole aggreage is automatically saved/deleted when the root is saved/deleted. Without having to manually mark each ‘has_many’ as autosave/delete.

Installation¶ ↑

Rails 2.3.x¶ ↑

Acts As AggregateRoot is tested to work in Rails 2.3.5.

config.gem “acts_as_aggregate_root” After that, you can run “rake gems:install” to install the gem if you don’t already have it.

Testing¶ ↑

Acts As Aggregate Root uses RSpec for its test coverage.

If you already have RSpec on your application, the specs will run while using:

rake spec:plugins

Usage¶ ↑

  class Order < ActiveRecord::Base
    acts_as_aggregate_root
    has_many :order_items
  end

  class OrderItem < ActiveRecord::Base
    belongs_to :order
  end

Order.first.destroy
Order.all.count == 0
OrderItem.all.count ==0

Contributing to acts-as-aggregate-root¶ ↑

  • 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 © 2011 Surya Gaddipati. See LICENSE.txt for further details.