unidom-standard 0.2 → 0.3
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 +4 -4
- data/README.md +8 -0
- data/app/assets/javascripts/unidom/standard/application.js +1 -1
- data/app/assets/stylesheets/unidom/standard/application.css +0 -1
- data/app/models/unidom/standard/standard.rb +2 -2
- data/app/models/unidom/standard/standard_associating.rb +5 -1
- data/app/views/layouts/unidom/standard/application.html.erb +3 -2
- data/lib/unidom/standard/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee5fec3f6402f4e2263a1ed12b89e1f2ef50db0b
|
4
|
+
data.tar.gz: 88af1ecc49d7b3187553e75eca0e6c78ba7c5d4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce388958435617dc9f4a20a703603a86cc409d7380e8d72f91337da49dc9267361c1c1fae3fd75d119eee50a18576306bbb81529c4547e75a2714c2194a28424
|
7
|
+
data.tar.gz: d32b835cc4670fe291e022514bd7c94a0332b36753c9778c0427e940fe677493e658fc925c73d20699fb97d7f8da0210fb7235b1a2b7b45ad3545195dc16a3e6
|
data/README.md
CHANGED
@@ -6,6 +6,10 @@
|
|
6
6
|
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Standard domain model engine includes the Standard and Standard Association models.
|
7
7
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。标准领域模型引擎包括标准和标准关联的模型。
|
8
8
|
|
9
|
+
## Recent Update
|
10
|
+
Check out the [Road Map](ROADMAP.md) to find out what's the next.
|
11
|
+
Check out the [Change Log](CHANGELOG.md) to find out what's new.
|
12
|
+
|
9
13
|
## Usage in Gemfile
|
10
14
|
```ruby
|
11
15
|
gem 'unidom-standard'
|
@@ -15,6 +19,7 @@ gem 'unidom-standard'
|
|
15
19
|
```shell
|
16
20
|
rake db:migrate
|
17
21
|
```
|
22
|
+
The migration versions start with 200006.
|
18
23
|
|
19
24
|
## Call the Model
|
20
25
|
```ruby
|
@@ -23,4 +28,7 @@ gbk.source_standards.merge(Unidom::Standard::StandardAssociating.association_cod
|
|
23
28
|
# The standards revises GBK.
|
24
29
|
gbk.target_standards.merge(Unidom::Standard::StandardAssociating.association_coded_as('REVS').valid_at.alive).valid_at.alive
|
25
30
|
# The standards revised by GBK, such as GB2312.
|
31
|
+
|
32
|
+
# GBK revise GB2312
|
33
|
+
Unidom::Standard::StandardAssociating.associate! gbk, gb2312, 'REVS'
|
26
34
|
```
|
@@ -11,6 +11,8 @@ class Unidom::Standard::Standard < ActiveRecord::Base
|
|
11
11
|
|
12
12
|
self.table_name = 'unidom_standards'
|
13
13
|
|
14
|
+
include Unidom::Common::Concerns::ModelExtension
|
15
|
+
|
14
16
|
validates :name, presence: true, length: { in: 2..self.columns_hash['name'].limit }
|
15
17
|
validates :number, presence: true, length: { in: 2..self.columns_hash['number'].limit }, uniqueness: true
|
16
18
|
|
@@ -21,6 +23,4 @@ class Unidom::Standard::Standard < ActiveRecord::Base
|
|
21
23
|
has_many :source_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :target_id # as: :target
|
22
24
|
has_many :source_standards, through: :source_associatings, source: :source
|
23
25
|
|
24
|
-
include Unidom::Common::Concerns::ModelExtension
|
25
|
-
|
26
26
|
end
|
@@ -4,12 +4,16 @@ class Unidom::Standard::StandardAssociating < ActiveRecord::Base
|
|
4
4
|
|
5
5
|
self.table_name = 'unidom_standard_associatings'
|
6
6
|
|
7
|
+
include Unidom::Common::Concerns::ModelExtension
|
8
|
+
|
7
9
|
scope :source_is, ->(source) { where source_id: (source.respond_to?(:id) ? source.id : source) }
|
8
10
|
scope :target_is, ->(target) { where target_id: (target.respond_to?(:id) ? target.id : target) }
|
9
11
|
|
10
12
|
belongs_to :source, class_name: 'Unidom::Standard::Standard', foreign_key: :source_id
|
11
13
|
belongs_to :target, class_name: 'Unidom::Standard::Standard', foreign_key: :target_id
|
12
14
|
|
13
|
-
|
15
|
+
def self.associate!(source, target, association_code = 'REVS', opened_at: Time.now)
|
16
|
+
create! source_id: to_id(source), target_id: to_id(target), association_code: association_code, opened_at: opened_at
|
17
|
+
end
|
14
18
|
|
15
19
|
end
|
@@ -2,13 +2,14 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<title>Unidom Standard</title>
|
5
|
-
<%= stylesheet_link_tag
|
6
|
-
<%= javascript_include_tag 'standard/application' %>
|
5
|
+
<%= stylesheet_link_tag 'unidom/standard/application', media: 'all' %>
|
7
6
|
<%= csrf_meta_tags %>
|
8
7
|
</head>
|
9
8
|
<body>
|
10
9
|
|
11
10
|
<%= yield %>
|
12
11
|
|
12
|
+
<%= javascript_include_tag 'standard/application' %>
|
13
|
+
|
13
14
|
</body>
|
14
15
|
</html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-standard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
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-
|
11
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.9'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.9'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
28
|
The Standard domain model engine includes Standard and Standard Association models.
|
29
29
|
Unidom (统一领域对象模型)是一系列的领域模型引擎。标准领域模型引擎包括标准和标准关联的模型。
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.4
|
73
|
+
rubygems_version: 2.6.4
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Unidom Standard Domain Model Engine 标准领域模型引擎
|