espace_membre-ruby 1.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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2399b73d995dfdfe2f411e7e65dbb62cef595afdb94626f2b84307e67af46baa
|
|
4
|
+
data.tar.gz: ce273320ba11c6c482e0102089cf9dd482558bfad5def8107ff526c8065530d1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d81f1e2e53c400e40c74953d195b48da87f05360931e33fc5a991d5d20efe28570c9cb2f814bee43f0339d252356844b6a3b0efd3974af39eb24f89f20b7fcc
|
|
7
|
+
data.tar.gz: 605360aa0096437bafee344e650daab4bfa6c282ad88073b9025a55cdc269a008da8e4333d7c62149ac7d3bfbbbb5b7fc8ce211c105a99bff00db3eeebd75dd6
|
|
@@ -4,6 +4,10 @@ module EspaceMembre
|
|
|
4
4
|
|
|
5
5
|
belongs_to :incubator
|
|
6
6
|
|
|
7
|
+
has_and_belongs_to_many :incubators, join_table: "startups_incubators"
|
|
8
|
+
|
|
9
|
+
after_save :link_principal_incubator
|
|
10
|
+
|
|
7
11
|
has_many :phases
|
|
8
12
|
|
|
9
13
|
has_and_belongs_to_many :organizations, join_table: "startups_organizations"
|
|
@@ -19,6 +23,9 @@ module EspaceMembre
|
|
|
19
23
|
class_name: "Phase",
|
|
20
24
|
inverse_of: :startup
|
|
21
25
|
|
|
26
|
+
belongs_to :contact_incubator, class_name: "User", foreign_key: "contact_incubator"
|
|
27
|
+
belongs_to :contact_dinum, class_name: "User", foreign_key: "contact_dinum"
|
|
28
|
+
|
|
22
29
|
# we must use this tragic hack because a startup can have one or
|
|
23
30
|
# more phases without an 'end' timestamp, which is wrong and
|
|
24
31
|
# misleading but that's how the data exists. So instead of
|
|
@@ -38,5 +45,17 @@ module EspaceMembre
|
|
|
38
45
|
def to_s
|
|
39
46
|
name
|
|
40
47
|
end
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
# The `startups_incubators` join table is the source of truth for the
|
|
52
|
+
# startup/incubator relationship and the database enforces (via a
|
|
53
|
+
# deferred FK) that a startup's principal incubator is present in the
|
|
54
|
+
# join table. Make sure we keep the principal incubator in sync.
|
|
55
|
+
def link_principal_incubator
|
|
56
|
+
return if incubator.nil?
|
|
57
|
+
|
|
58
|
+
incubators << incubator unless incubators.include?(incubator)
|
|
59
|
+
end
|
|
41
60
|
end
|
|
42
61
|
end
|
|
@@ -2,11 +2,13 @@ require 'faker'
|
|
|
2
2
|
|
|
3
3
|
FactoryBot.define do
|
|
4
4
|
factory :startup, class: "EspaceMembre::Startup" do
|
|
5
|
-
ghid { Faker::
|
|
5
|
+
ghid { Faker::Internet.slug }
|
|
6
6
|
uuid { Faker::Internet.uuid }
|
|
7
7
|
name { Faker::Lorem.word }
|
|
8
8
|
description { Faker::Lorem.paragraph }
|
|
9
9
|
incubator
|
|
10
|
+
contact_incubator { FactoryBot.create(:user) }
|
|
11
|
+
contact_dinum { FactoryBot.create(:user) }
|
|
10
12
|
|
|
11
13
|
trait :in_investigation do
|
|
12
14
|
after(:create) do |startup|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: espace_membre-ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: '1.2'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stéphane Maniaci
|
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
71
71
|
- !ruby/object:Gem::Version
|
|
72
72
|
version: '0'
|
|
73
73
|
requirements: []
|
|
74
|
-
rubygems_version: 4.0.
|
|
74
|
+
rubygems_version: 4.0.20
|
|
75
75
|
specification_version: 4
|
|
76
76
|
summary: A collection of Ruby code around the EspaceMembre app
|
|
77
77
|
test_files: []
|