uuid_associations-active_record 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -3
- data/Appraisals +2 -2
- data/gemfiles/active_record_4.2.gemfile +1 -1
- data/gemfiles/active_record_5.0.gemfile +1 -1
- data/lib/uuid_associations/active_record/association_method_definitions.rb +4 -0
- data/lib/uuid_associations/active_record/relationship_definitions/base.rb +8 -1
- data/lib/uuid_associations/active_record/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04434300525cb3350da2af614944510ac429d8daa8b8af49307d77d9f2256162
|
4
|
+
data.tar.gz: dafecc48f8fc8f310d64918b969dd9604f626756a84f5d30b63ac85ec1d46e4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7def67cca35d303168a43a9fe6d150b9a4015b200fc06f0ad64ecce01e4cafcb6c8b073f35b5e2bf47a8d061586486496d90e856d2401b5c2dd2e832eb816482
|
7
|
+
data.tar.gz: b667b979c70bc6dd31f462f7bb199b6db0b7958f62b5dc07b60c1ed833a9ae5503976453ba48282843dab64fc54877a0581007b2e50c622a1b74afb91c54a75f
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
appraise 'active_record_4.2' do
|
2
|
-
gem 'sqlite3'
|
2
|
+
gem 'sqlite3', '~> 1.3.6'
|
3
3
|
gem 'activerecord', github: 'rails/rails', branch: '4-2-stable'
|
4
4
|
end
|
5
5
|
|
6
6
|
appraise 'active_record_5.0' do
|
7
|
-
gem 'sqlite3'
|
7
|
+
gem 'sqlite3', '~> 1.3.6'
|
8
8
|
gem 'activerecord', github: 'rails/rails', branch: '5-0-stable'
|
9
9
|
end
|
10
10
|
|
@@ -7,6 +7,8 @@ module UuidAssociations
|
|
7
7
|
def has_many(name, scope = nil, **options, &extension)
|
8
8
|
original_payload = super(name, scope, options, &extension)
|
9
9
|
RelationshipDefinitions::HasMany.define_accesors_for(self, original_payload, name)
|
10
|
+
|
11
|
+
original_payload
|
10
12
|
end
|
11
13
|
|
12
14
|
def belongs_to(name, scope = nil, **options)
|
@@ -14,6 +16,8 @@ module UuidAssociations
|
|
14
16
|
return original_payload if original_payload.key?('left_side')
|
15
17
|
|
16
18
|
RelationshipDefinitions::BelongsTo.define_accesors_for(self, original_payload, name)
|
19
|
+
|
20
|
+
original_payload
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
@@ -14,7 +14,9 @@ module UuidAssociations
|
|
14
14
|
|
15
15
|
def call
|
16
16
|
reflection = find_reflection(payload)
|
17
|
-
|
17
|
+
|
18
|
+
association_class_name = class_name_from_reflection(reflection)
|
19
|
+
return payload if association_class_name.nil?
|
18
20
|
|
19
21
|
define_accesors(klass, association_class_name) if uuid_column?(association_class_name)
|
20
22
|
|
@@ -25,6 +27,11 @@ module UuidAssociations
|
|
25
27
|
|
26
28
|
attr_reader :payload, :klass, :name
|
27
29
|
|
30
|
+
def class_name_from_reflection(reflection)
|
31
|
+
reflection.class_name
|
32
|
+
rescue NoMethodError
|
33
|
+
end
|
34
|
+
|
28
35
|
def find_reflection(payload)
|
29
36
|
payload[name]
|
30
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uuid_associations-active_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Celi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.7.
|
186
|
+
rubygems_version: 2.7.9
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: Helper methods for UUID associations in Active Record
|