unidom-standard 0.2 → 0.3

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: beb9c96a32c4e73edbd9386f7957973d5eb1cbd2
4
- data.tar.gz: 132472d93047b81ee0d3607007fae55eec345050
3
+ metadata.gz: ee5fec3f6402f4e2263a1ed12b89e1f2ef50db0b
4
+ data.tar.gz: 88af1ecc49d7b3187553e75eca0e6c78ba7c5d4c
5
5
  SHA512:
6
- metadata.gz: 54729bb33923534fe779fd3526be03f4947eb2d84d1fffbc41349ce9f24e3c34f39a9673e722383b9ce3cc7b94cac480da4c470262aab621dc93955809824893
7
- data.tar.gz: 59f46b255ef3c137a2a89c8b6488f70941da6de65405ae7d6bb0c5bd5a197a2c218d8a0df9b695bd6123e14f1fcc37b5dfc5ccc6d9db52f477a9cb65b87209e9
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
  ```
@@ -10,4 +10,4 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require_tree .
13
+ //= require_self
@@ -10,6 +10,5 @@
10
10
  * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
11
  * file per style scope.
12
12
  *
13
- *= require_tree .
14
13
  *= require_self
15
14
  */
@@ -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
- include Unidom::Common::Concerns::ModelExtension
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 'standard/application', media: 'all' %>
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>
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Standard
3
- VERSION = '0.2'.freeze
3
+ VERSION = '0.3'.freeze
4
4
  end
5
5
  end
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.2'
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-03-09 00:00:00.000000000 Z
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.3'
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.3'
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.5.1
73
+ rubygems_version: 2.6.4
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: Unidom Standard Domain Model Engine 标准领域模型引擎