README.md in unidom-action-0.4 vs README.md in unidom-action-0.5

- old
+ new

@@ -5,26 +5,38 @@ [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-action.svg)](https://gemnasium.com/github.com/topbitdu/unidom-action) Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Action domain model engine includes the Reason, State Transition, Obsolescene, and the Acting models. Unidom (统一领域对象模型)是一系列的领域模型引擎。审计领域模型引擎包括原因、状态迁移、废弃和行为日志的模型。 + + ## Recent Update + Check out the [Road Map](ROADMAP.md) to find out what's the next. Check out the [Change Log](CHANGELOG.md) to find out what's new. + + ## Usage in Gemfile + ```ruby gem 'unidom-action' ``` + + ## Run the Database Migration + ```shell rake db:migrate ``` The migration versions start with 200005. + + ## Call the Model + ```ruby reason = Unidom::Action::Reason.create! activity_code: 'SRRR', name: 'broken', description: 'The box was broken.' # SRRR = Shipment Receipt Rejection Reason user = Unidom::Visitor::User.create! @@ -42,13 +54,29 @@ person.soft_destroy obsolescence = Unidom::Action::Obsolescence.create! obsolescer_visitor: user, obsolescer_party: person, reason: reason, obsolesced: person # The reason could be nil. ``` + + ## Include the Concern + ```ruby +include Unidom::Action::Concerns::AsActed +include Unidom::Action::Concerns::AsObsolesced include Unidom::Action::Concerns::AsStateSubject ``` +### As Acted concern + +The As Acted concern do the following tasks for the includer automatically: +1. Define the has_many :actings macro as: ``has_many :actings, class_name: 'Unidom::Action::Acting', as: :acted`` + +### As Obsolesced concern + +The As Obsolesced concern do the following tasks for the includer automatically: +1. Define the has_many :obsolescings macro as: ``has_many :obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolesced`` + ### As State Subject concern + The As State Subject concern do the following tasks for the includer automatically: 1. Define the has_many :state_transitions macro as: ``has_many :state_transitions, class_name: 'Unidom::Action::StateTransition', as: :subject``