unidom-action 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 380407c921dd3d237c8a7c398f30d444996dd869
4
- data.tar.gz: 10ee02a67e68a196af14a6ac391b25c21266ade5
3
+ metadata.gz: f8304dab4d4d76575eeaa456eaf56c4a84e68810
4
+ data.tar.gz: 7e3d94fd5860a7c2b9dbe43230f8d0767c54754e
5
5
  SHA512:
6
- metadata.gz: 90c25d3596aaf81d443bb7129242db938ed502e9dc628e7be8394567801d9d7f2bf21520b756b7366404f5e68ebb4b3554ff9721a31202353b7d297f6b2f7d60
7
- data.tar.gz: 8d3f620b72ecc02567d220469a56ae4295a28b30bcf5efc8631a4d2badc3b8c3efe49a465d048adb9a70447ed48827319eab492741dd397ba1ca4463ee35ef54
6
+ metadata.gz: 884cc42787b35880f9b792683be097bc38bafe9b982a7c080a950f70dd841b1f45721232cd3bc96638848777a41f88c00609b755b8d8d2a3e2f4d25336cd9fd3
7
+ data.tar.gz: 6b2983632f465bebdbf97230bf4b343acc44cf6bda450a0899c82c21ff341be7d77e5e4ead18d6eaf2f6d48d135df71600bde226a831c97f35cabec6f04917ba
data/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT)
4
4
  [![Gem Version](https://badge.fury.io/rb/unidom-action.svg)](https://badge.fury.io/rb/unidom-action)
5
+ [![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-action.svg)](https://gemnasium.com/github.com/topbitdu/unidom-action)
5
6
 
6
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.
7
8
  Unidom (统一领域对象模型)是一系列的领域模型引擎。审计领域模型引擎包括原因、状态迁移、废弃和行为日志的模型。
@@ -42,3 +43,12 @@ person.soft_destroy
42
43
  obsolescence = Unidom::Action::Obsolescence.create! obsolescer_visitor: user, obsolescer_party: person, reason: reason, obsolesced: person
43
44
  # The reason could be nil.
44
45
  ```
46
+
47
+ ## Include the Concern
48
+ ```ruby
49
+ include Unidom::Action::Concerns::AsStateSubject
50
+ ```
51
+
52
+ ### As State Subject concern
53
+ The As State Subject concern do the following tasks for the includer automatically:
54
+ 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::AsStateSubject
2
+
3
+ extend ActiveSupport::Concern
4
+
5
+ included do |includer|
6
+
7
+ has_many :state_transitions, class_name: 'Unidom::Action::StateTransition', as: :subject
8
+
9
+ end
10
+
11
+ module ClassMethods
12
+ end
13
+
14
+ end
@@ -1,10 +1,11 @@
1
- # Obsolescence 是废弃。
1
+ # Obsolescing 是废弃。
2
2
  # #reason 是原因。
3
3
  # #obsolesced 是被废弃的对象。
4
+ # #obsolescence_code 是废弃代码,OBSL 表示废弃, RCVR 表示恢复。
4
5
 
5
- class Unidom::Action::Obsolescence < Unidom::Action::ApplicationRecord
6
+ class Unidom::Action::Obsolescing < Unidom::Action::ApplicationRecord
6
7
 
7
- self.table_name = 'unidom_obsolescences'
8
+ self.table_name = 'unidom_obsolescings'
8
9
 
9
10
  include Unidom::Common::Concerns::ModelExtension
10
11
 
@@ -1,8 +1,8 @@
1
- class CreateUnidomObsolescences < ActiveRecord::Migration
1
+ class CreateUnidomObsolescings < ActiveRecord::Migration
2
2
 
3
3
  def change
4
4
 
5
- create_table :unidom_obsolescences, id: :uuid do |t|
5
+ create_table :unidom_obsolescings, id: :uuid do |t|
6
6
 
7
7
  t.references :obsolescer_visitor, type: :uuid, null: false,
8
8
  polymorphic: { null: false, default: '', limit: 200 }
@@ -12,6 +12,8 @@ class CreateUnidomObsolescences < ActiveRecord::Migration
12
12
  polymorphic: { null: false, default: '', limit: 200 }
13
13
  t.references :reason, type: :uuid, null: true
14
14
 
15
+ t.column :obsolescence_code, 'char(4)', null: false, default: 'OBSL'
16
+
15
17
  t.column :state, 'char(1)', null: false, default: 'C'
16
18
  t.datetime :opened_at, null: false, default: Time.utc(1970)
17
19
  t.datetime :closed_at, null: false, default: Time.utc(3000)
@@ -22,10 +24,10 @@ class CreateUnidomObsolescences < ActiveRecord::Migration
22
24
 
23
25
  end
24
26
 
25
- add_index :unidom_obsolescences, :obsolescer_visitor_id
26
- add_index :unidom_obsolescences, :obsolescer_party_id
27
- add_index :unidom_obsolescences, :obsolesced_id
28
- add_index :unidom_obsolescences, :reason_id
27
+ add_index :unidom_obsolescings, :obsolescer_visitor_id
28
+ add_index :unidom_obsolescings, :obsolescer_party_id
29
+ add_index :unidom_obsolescings, :obsolesced_id
30
+ add_index :unidom_obsolescings, :reason_id
29
31
 
30
32
  end
31
33
 
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '0.3'.freeze
3
+ VERSION = '0.4'.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.3'
4
+ version: '0.4'
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-09-29 00:00:00.000000000 Z
11
+ date: 2016-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -45,7 +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/obsolescence.rb
48
+ - app/models/unidom/action/concerns/as_state_subject.rb
49
+ - app/models/unidom/action/obsolescing.rb
49
50
  - app/models/unidom/action/reason.rb
50
51
  - app/models/unidom/action/state_transition.rb
51
52
  - app/views/layouts/unidom/action/application.html.erb
@@ -53,7 +54,7 @@ files:
53
54
  - db/migrate/20000501000000_create_unidom_reasons.rb
54
55
  - db/migrate/20000510000000_create_unidom_actings.rb
55
56
  - db/migrate/20000511000000_create_unidom_state_transitions.rb
56
- - db/migrate/20000512000000_create_unidom_obsolescences.rb
57
+ - db/migrate/20000512000000_create_unidom_obsolescings.rb
57
58
  - lib/tasks/action_tasks.rake
58
59
  - lib/unidom/action.rb
59
60
  - lib/unidom/action/engine.rb