unidom-action 0.4 → 0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8304dab4d4d76575eeaa456eaf56c4a84e68810
4
- data.tar.gz: 7e3d94fd5860a7c2b9dbe43230f8d0767c54754e
3
+ metadata.gz: 4c5fb32cd1d3c846164bc08a7114405f0f85d6b9
4
+ data.tar.gz: cf7518c92df11c04be521281f47e75a09b0d6cc8
5
5
  SHA512:
6
- metadata.gz: 884cc42787b35880f9b792683be097bc38bafe9b982a7c080a950f70dd841b1f45721232cd3bc96638848777a41f88c00609b755b8d8d2a3e2f4d25336cd9fd3
7
- data.tar.gz: 6b2983632f465bebdbf97230bf4b343acc44cf6bda450a0899c82c21ff341be7d77e5e4ead18d6eaf2f6d48d135df71600bde226a831c97f35cabec6f04917ba
6
+ metadata.gz: e30143137d04a9424551ba5284d309a42459caa3770849213f7cc2afbf0c6bde85ec99dca2abb1a7fac0158b58c7af1c97c9ad1f9df959870383d39d1db98a2e
7
+ data.tar.gz: 4219ebbfb62322733de9bca73b6d7c9a9533902022d378180b6ce11e7c41034474f529929ac6bcd08335af6dcc062f9fcd770d9b5eca56b8e7dad9078d8ad2fa
data/README.md CHANGED
@@ -7,22 +7,34 @@
7
7
  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.
8
8
  Unidom (统一领域对象模型)是一系列的领域模型引擎。审计领域模型引擎包括原因、状态迁移、废弃和行为日志的模型。
9
9
 
10
+
11
+
10
12
  ## Recent Update
13
+
11
14
  Check out the [Road Map](ROADMAP.md) to find out what's the next.
12
15
  Check out the [Change Log](CHANGELOG.md) to find out what's new.
13
16
 
17
+
18
+
14
19
  ## Usage in Gemfile
20
+
15
21
  ```ruby
16
22
  gem 'unidom-action'
17
23
  ```
18
24
 
25
+
26
+
19
27
  ## Run the Database Migration
28
+
20
29
  ```shell
21
30
  rake db:migrate
22
31
  ```
23
32
  The migration versions start with 200005.
24
33
 
34
+
35
+
25
36
  ## Call the Model
37
+
26
38
  ```ruby
27
39
  reason = Unidom::Action::Reason.create! activity_code: 'SRRR', name: 'broken', description: 'The box was broken.'
28
40
  # SRRR = Shipment Receipt Rejection Reason
@@ -44,11 +56,27 @@ obsolescence = Unidom::Action::Obsolescence.create! obsolescer_visitor: user, ob
44
56
  # The reason could be nil.
45
57
  ```
46
58
 
59
+
60
+
47
61
  ## Include the Concern
62
+
48
63
  ```ruby
64
+ include Unidom::Action::Concerns::AsActed
65
+ include Unidom::Action::Concerns::AsObsolesced
49
66
  include Unidom::Action::Concerns::AsStateSubject
50
67
  ```
51
68
 
69
+ ### As Acted concern
70
+
71
+ The As Acted concern do the following tasks for the includer automatically:
72
+ 1. Define the has_many :actings macro as: ``has_many :actings, class_name: 'Unidom::Action::Acting', as: :acted``
73
+
74
+ ### As Obsolesced concern
75
+
76
+ The As Obsolesced concern do the following tasks for the includer automatically:
77
+ 1. Define the has_many :obsolescings macro as: ``has_many :obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolesced``
78
+
52
79
  ### As State Subject concern
80
+
53
81
  The As State Subject concern do the following tasks for the includer automatically:
54
82
  1. Define the has_many :state_transitions macro as: ``has_many :state_transitions, class_name: 'Unidom::Action::StateTransition', as: :subject``
@@ -0,0 +1,14 @@
1
+ module Unidom::Action::Concerns::AsActed
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :actings, class_name: 'Unidom::Action::Acting', as: :acted
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -0,0 +1,14 @@
1
+ module Unidom::Action::Concerns::AsObsolesced
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolesced
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '0.4'.freeze
3
+ VERSION = '0.5'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-action
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-01 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -45,6 +45,8 @@ files:
45
45
  - app/mailers/unidom/action/application_mailer.rb
46
46
  - app/models/unidom/action/acting.rb
47
47
  - app/models/unidom/action/application_record.rb
48
+ - app/models/unidom/action/concerns/as_acted.rb
49
+ - app/models/unidom/action/concerns/as_obsolesced.rb
48
50
  - app/models/unidom/action/concerns/as_state_subject.rb
49
51
  - app/models/unidom/action/obsolescing.rb
50
52
  - app/models/unidom/action/reason.rb