unidom-position 1.3 → 1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a325387226fa0999af27eaae18507795913ea095
|
4
|
+
data.tar.gz: a3b4c43bc38dbf72d60b6107145587c8721f445a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d8c58a8bb124046ef4230e7ece3bebf815b70a77866d9461fb540a4f7d30720a2076837a6eba5abf0801a66cba00ae419928558032262f0aba6298310d2bd76
|
7
|
+
data.tar.gz: 94a34fb04dfc9b320e36a08d2535d020ad9da9c34e698c7d62d2614fff4a0b0888ee2500967f77522a1082f2933a7b3920f52c4b8b6f06cc7a96e147b2f8451a
|
data/README.md
CHANGED
@@ -53,10 +53,12 @@ include Unidom::Position::Concerns::AsSuperiorPost
|
|
53
53
|
The As Inferior Post concern do the following tasks for the includer automatically:
|
54
54
|
1. Define the has_many :superior_post_reporting_structures macro as: ``has_many :superior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :inferior_post, foreign_key: :inferior_post_id``
|
55
55
|
2. Define the has_many :superior_posts macro as: ``has_many :superior_posts, through: :superior_post_reporting_structures, source: :superior_post``
|
56
|
-
3. Define the #report_to! method as: ``
|
56
|
+
3. Define the #report_to! method as: ``report_to!(superior_post, at: Time.now, primary: true)``
|
57
|
+
4. Define the #report_to? method as: ``report_to?(superior_post, at: Time.now, primary: true)``
|
57
58
|
|
58
59
|
### As Superior Post
|
59
60
|
The As Superior Post concern do the following tasks for the includer automatically:
|
60
61
|
1. Define the has_many :inferior_post_reporting_structures macro as: ``has_many :inferior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :superior_post, foreign_key: :superior_post_id``
|
61
62
|
2. Define the has_many :inferior_posts macro as: ``has_many :inferior_posts, through: :inferior_post_reporting_structures, source: :inferior_post``
|
62
|
-
3. Define the #is_reported_to! method as: ``
|
63
|
+
3. Define the #is_reported_to! method as: ``is_reported_to!(by: nil, at: Time.now, primary: true)``
|
64
|
+
4. Define the #is_reported_to? method as: ``is_reported_to?(by: nil, at: Time.now, primary: true)``
|
@@ -7,8 +7,12 @@ module Unidom::Position::Concerns::AsInferiorPost
|
|
7
7
|
has_many :superior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :inferior_post, foreign_key: :inferior_post_id
|
8
8
|
has_many :superior_posts, through: :superior_post_reporting_structures, source: :superior_post
|
9
9
|
|
10
|
-
def report_to!(superior_post, at: Time.now, primary:
|
11
|
-
superior_post_reporting_structures.
|
10
|
+
def report_to!(superior_post, at: Time.now, primary: true)
|
11
|
+
superior_post_reporting_structures.superior_post_is(superior_post).valid_at(now: at).alive.first_or_create! elemental: primary, opened_at: at
|
12
|
+
end
|
13
|
+
|
14
|
+
def report_to?(superior_post, at: Time.now, primary: true)
|
15
|
+
superior_post_reporting_structures.superior_post_is(superior_post).valid_at(now: at).alive.primary(primary).exists?
|
12
16
|
end
|
13
17
|
|
14
18
|
end
|
@@ -7,8 +7,12 @@ module Unidom::Position::Concerns::AsSuperiorPost
|
|
7
7
|
has_many :inferior_post_reporting_structures, class_name: 'Unidom::Position::PostReportingStructure', source: :superior_post, foreign_key: :superior_post_id
|
8
8
|
has_many :inferior_posts, through: :inferior_post_reporting_structures, source: :inferior_post
|
9
9
|
|
10
|
-
def is_reported_to!(by: nil, at: Time.now, primary:
|
11
|
-
inferior_post_reporting_structures.
|
10
|
+
def is_reported_to!(by: nil, at: Time.now, primary: true)
|
11
|
+
inferior_post_reporting_structures.inferior_post_is(by).valid_at(now: at).alive.first_or_create! elemental: primary, opened_at: at
|
12
|
+
end
|
13
|
+
|
14
|
+
def is_reported_to?(by: nil, at: Time.now, primary: true)
|
15
|
+
inferior_post_reporting_structures.inferior_post_is(by).valid_at(now: at).alive.primary(primary).exists?
|
12
16
|
end
|
13
17
|
|
14
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-position
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.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-
|
11
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|