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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9d16956786a4619808d4bfc36e349dc896fb770394205878fd014f64147b3b3
4
- data.tar.gz: 76311e6e020683e0de474af596fb35d212a062381a3fd372e1b3e9d72b21d1e1
3
+ metadata.gz: 04434300525cb3350da2af614944510ac429d8daa8b8af49307d77d9f2256162
4
+ data.tar.gz: dafecc48f8fc8f310d64918b969dd9604f626756a84f5d30b63ac85ec1d46e4e
5
5
  SHA512:
6
- metadata.gz: 6eff3256a546c425eb96188af3c4b433a5727aee22f0b71dfc4e8f57bc15c9b3f2ba26da0a0ee91be41637606aca499edf4e4b4d7d31a34cdfc9d7091b7e1c46
7
- data.tar.gz: 60336c03e86575186df2062bb2932d57eb163099673c420b5cabeec8b8d57a58048b53548dd40620225af92c2772495b7bd684b40b2fcc7592eaa1b1284ab362
6
+ metadata.gz: 7def67cca35d303168a43a9fe6d150b9a4015b200fc06f0ad64ecce01e4cafcb6c8b073f35b5e2bf47a8d061586486496d90e856d2401b5c2dd2e832eb816482
7
+ data.tar.gz: b667b979c70bc6dd31f462f7bb199b6db0b7958f62b5dc07b60c1ed833a9ae5503976453ba48282843dab64fc54877a0581007b2e50c622a1b74afb91c54a75f
data/.travis.yml CHANGED
@@ -3,9 +3,6 @@ language: ruby
3
3
  sudo: false
4
4
  cache: bundler
5
5
 
6
- before_install:
7
- - type bundle >/dev/null 2>&1 || gem install bundler -v '< 2'
8
-
9
6
  rvm:
10
7
  - 2.2.10
11
8
  - 2.3.8
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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "sqlite3"
5
+ gem "sqlite3", "~> 1.3.6"
6
6
  gem "activerecord", github: "rails/rails", branch: "4-2-stable"
7
7
 
8
8
  gemspec path: "../"
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "sqlite3"
5
+ gem "sqlite3", "~> 1.3.6"
6
6
  gem "activerecord", github: "rails/rails", branch: "5-0-stable"
7
7
 
8
8
  gemspec path: "../"
@@ -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
- association_class_name = reflection.class_name
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
@@ -1,5 +1,5 @@
1
1
  module UuidAssociations
2
2
  module ActiveRecord
3
- VERSION = '0.3.3'.freeze
3
+ VERSION = '0.3.4'.freeze
4
4
  end
5
5
  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.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-01-08 00:00:00.000000000 Z
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.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