uuid_associations-active_record 0.4.3 → 0.4.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e43263533af6af17d5bb3d1f73be1be3e076052da67bf5f2a4f22877abd0d3b3
|
4
|
+
data.tar.gz: 78b72e5dd4db907355445333fea8ea4274e3ea1ddf48d126d9a06e3901e3d04b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddd1de7737a56a30d93db2fe5a74295f2dd076f7eaa94e49eb3c16071e835bd32e9191bfa97da70967247e9d439731ae6c2a895a1bf74fb559dd5c0e820d2a31
|
7
|
+
data.tar.gz: 60b293ea81fe28782840cbc5831b011cdb03a19107d8fd5aac35c3a0d2c5ab3c2b94d36a911235d921cd7537c937063280b147674202625c814f7c730273f648
|
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
|
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.
|
4
|
+
version: 0.4.4
|
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: 2020-
|
11
|
+
date: 2020-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -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.1.
|
182
|
-
signing_key:
|
181
|
+
rubygems_version: 3.1.2
|
182
|
+
signing_key:
|
183
183
|
specification_version: 4
|
184
184
|
summary: Helper methods for UUID associations in Active Record
|
185
185
|
test_files:
|