uuid_associations-active_record 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +8 -0
- data/README.md +1 -1
- data/lib/uuid_associations/active_record/relationship_definitions/belongs_to.rb +5 -1
- data/lib/uuid_associations/active_record/version.rb +1 -1
- data/spec/integration/relationship_definitions/belongs_to_spec.rb +8 -0
- data/uuid_associations-active_record.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccf569422d54c246403f2b389a43928cda8e942c483c4eb6a2018eb4b0efeed0
|
4
|
+
data.tar.gz: ec377489e9fbd6160c5112f119c2bc2926a020c4cbe238c1e1862ddf3c4d2a89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c8349ddf77902cc6f7b928a6173dabe87034a529bca4587340a29db578005606071a5c0b87bc3d27b6d197298b203282c1895e9ab4cd6e0804168e54acfb76
|
7
|
+
data.tar.gz: 3e94d48823ad91ed60159e2ab60bff39401d56f9fa00371eb43549be2e80fc9e424e8bf5d9a5f9f5ea10bf33db478b18974befad3898e61f8d540ad5b09f80a4
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.4.4](https://github.com/mcelicalderon/uuid_associations-active_record/tree/v0.4.4) (2020-11-19)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/mcelicalderon/uuid_associations-active_record/compare/v0.4.3...v0.4.4)
|
6
|
+
|
7
|
+
**Fixed bugs:**
|
8
|
+
|
9
|
+
- Allow belongs\_to association to set nil values [\#7](https://github.com/mcelicalderon/uuid_associations-active_record/pull/7) ([mcelicalderon](https://github.com/mcelicalderon))
|
10
|
+
|
3
11
|
## [v0.4.3](https://github.com/mcelicalderon/uuid_associations-active_record/tree/v0.4.3) (2020-08-02)
|
4
12
|
|
5
13
|
[Full Changelog](https://github.com/mcelicalderon/uuid_associations-active_record/compare/v0.4.2...v0.4.3)
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# UUID Associations ActiveRecord
|
2
|
-
[![Build Status](https://travis-ci.
|
2
|
+
[![Build Status](https://travis-ci.com/mcelicalderon/uuid_associations-active_record.svg?branch=master)](https://travis-ci.com/mcelicalderon/uuid_associations-active_record)
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/uuid_associations-active_record.svg)](https://badge.fury.io/rb/uuid_associations-active_record)
|
4
4
|
|
5
5
|
## Table of Contents
|
@@ -11,7 +11,11 @@ module UuidAssociations
|
|
11
11
|
def define_accesors(klass, association_class_name)
|
12
12
|
klass.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
13
13
|
def #{name}_uuid=(uuid)
|
14
|
-
|
14
|
+
if uuid.nil?
|
15
|
+
self.#{name}_id = nil
|
16
|
+
else
|
17
|
+
self.#{name}_id = #{association_class_name}.find_by!(uuid: uuid).id
|
18
|
+
end
|
15
19
|
end
|
16
20
|
CODE
|
17
21
|
|
@@ -9,6 +9,14 @@ RSpec.describe 'belongs_to associations' do
|
|
9
9
|
|
10
10
|
expect(post.user_id).to eq(user.id)
|
11
11
|
end
|
12
|
+
|
13
|
+
context 'when provided a nil value' do
|
14
|
+
it 'sets a nil value' do
|
15
|
+
post = Post.create!(user_uuid: nil, content: 'my first comment')
|
16
|
+
|
17
|
+
expect(post.user_id).to be_nil
|
18
|
+
end
|
19
|
+
end
|
12
20
|
end
|
13
21
|
|
14
22
|
describe 'readers' do
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
|
29
29
|
spec.required_ruby_version = '>= 2.1'
|
30
30
|
|
31
|
-
spec.add_dependency 'activerecord', '>= 4.2', '<
|
31
|
+
spec.add_dependency 'activerecord', '>= 4.2', '< 8.0'
|
32
32
|
|
33
33
|
spec.add_development_dependency 'appraisal', '~> 2.0'
|
34
34
|
spec.add_development_dependency 'github_changelog_generator'
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Celi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '4.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '4.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: appraisal
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,7 +163,7 @@ licenses:
|
|
163
163
|
- MIT
|
164
164
|
metadata:
|
165
165
|
source_code_uri: https://github.com/mcelicalderon/uuid_associations-active_record
|
166
|
-
post_install_message:
|
166
|
+
post_install_message:
|
167
167
|
rdoc_options: []
|
168
168
|
require_paths:
|
169
169
|
- lib
|
@@ -178,8 +178,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
182
|
-
signing_key:
|
181
|
+
rubygems_version: 3.3.26
|
182
|
+
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Helper methods for UUID associations in Active Record
|
185
185
|
test_files:
|