unidom-standard 1.1 → 1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d089cfe024b797df5ef3c97e9ef80727a2e580d
|
4
|
+
data.tar.gz: 90c396b43e2b4508a84009cfd1319b48145b69de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a5b0c57bd3da3b3f3d4208f1964f05eae536e93c4598a318c76bede4a2c86aa3030aa6f395955979f2d4e341854548337fefe7274715c88433abc2a148b2805
|
7
|
+
data.tar.gz: 6f426bdebc2e020ed49417d7dde35bc1069bd22d21cf3208392163c970be8292940917bef707256cf850309b6ad9ce6068eea06c018f02e9e58fa7c5424b1811
|
data/README.md
CHANGED
@@ -45,8 +45,10 @@ include Unidom::Standard::Concerns::AsTargetStandard
|
|
45
45
|
The As Source Standard concern do the following tasks for the includer automatically:
|
46
46
|
1. Define the has_many :target_associatings macro as: ``has_many :target_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :source_id``
|
47
47
|
2. Define the has_many :target_standards macro as: ``has_many :target_standards, through: :target_associatings, source: :target``
|
48
|
+
3. Define the #associate! method as: ``associate!(target, due_to: 'REVS', at: Time.now)``
|
48
49
|
|
49
50
|
### As Target Standard concern
|
50
51
|
The As Target Standard concern do the following tasks for the includer automatically:
|
51
52
|
1. Define the has_many :source_associatings macro as: ``has_many :source_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :target_id``
|
52
53
|
2. Define the has_many :source_standards macro as: ``has_many :source_standards, through: :source_associatings, source: :source``
|
54
|
+
3. Define the #is_associated! method as: ``is_associated!(source, due_to: 'REVS', at: Time.now)``
|
@@ -7,6 +7,14 @@ module Unidom::Standard::Concerns::AsSourceStandard
|
|
7
7
|
has_many :target_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :source_id
|
8
8
|
has_many :target_standards, through: :target_associatings, source: :target
|
9
9
|
|
10
|
+
def associate!(target, due_to: 'REVS', at: Time.now)
|
11
|
+
target_associatings.target_is(target).association_coded_as(due_to).valid_at(now: at).alive.first_or_create! opened_at: at
|
12
|
+
end
|
13
|
+
|
14
|
+
#def associate?(target, due_to: 'REVS', at: Time.now)
|
15
|
+
# target_associatings.target_is(target).association_coded_as(due_to).valid_at(now: at).alive.exists?
|
16
|
+
#end
|
17
|
+
|
10
18
|
end
|
11
19
|
|
12
20
|
module ClassMethods
|
@@ -7,6 +7,14 @@ module Unidom::Standard::Concerns::AsTargetStandard
|
|
7
7
|
has_many :source_associatings, class_name: 'Unidom::Standard::StandardAssociating', foreign_key: :target_id
|
8
8
|
has_many :source_standards, through: :source_associatings, source: :source
|
9
9
|
|
10
|
+
def is_associated!(source, due_to: 'REVS', at: Time.now)
|
11
|
+
source_associatings.source_is(source).association_coded_as(due_to).valid_at(now: at).alive.first_or_create! opened_at: at
|
12
|
+
end
|
13
|
+
|
14
|
+
#def is_associated?(source, due_to: 'REVS', at: Time.now)
|
15
|
+
# source_associatings.source_is(source).association_coded_as(due_to).valid_at(now: at).alive.exists?
|
16
|
+
#end
|
17
|
+
|
10
18
|
end
|
11
19
|
|
12
20
|
module ClassMethods
|
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: '1.
|
4
|
+
version: '1.2'
|
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-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|