mno-enterprise-core 2.0.6 → 2.0.7
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8199d332fbf50bd3d639dfe2459e7329eb96b50
|
4
|
+
data.tar.gz: beccbb31a39bbcdd02b6c1f17a331dc004e8b629
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1b5c8f95e08f2cd2cbbb9cadbb07a752d31f03d830aac0af8f4024208f59720138923d10000acf74d7114058bd6e48d5d1997661d01d242edde32953d1fdb89
|
7
|
+
data.tar.gz: de3c722cb6e6df6f3854d511d2472746f1a7f326b80def73f428b1a75b86050f61e0818e74825116243a2d9cabf0ec10fb696e44913f4df805d2570be61845b9
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Backport https://github.com/remiprev/her/pull/343/files
|
2
|
+
# Fix belongs_to when foreign key is nil
|
3
|
+
module Her
|
4
|
+
module Model
|
5
|
+
module Associations
|
6
|
+
class BelongsToAssociation < Association
|
7
|
+
# @private
|
8
|
+
def fetch
|
9
|
+
foreign_key_value = @parent.attributes[@opts[:foreign_key].to_sym]
|
10
|
+
data_key_value = @parent.attributes[@opts[:data_key].to_sym]
|
11
|
+
return @opts[:default].try(:dup) if (@parent.attributes.include?(@name) && @parent.attributes[@name].nil? && @params.empty?) || (foreign_key_value.blank? && data_key_value.blank?)
|
12
|
+
|
13
|
+
return @cached_result unless @params.any? || @cached_result.nil?
|
14
|
+
return @parent.attributes[@name] unless @params.any? || @parent.attributes[@name].blank?
|
15
|
+
|
16
|
+
path_params = @parent.attributes.merge(@params.merge(@klass.primary_key => foreign_key_value))
|
17
|
+
path = build_association_path lambda { @klass.build_request_path(path_params) }
|
18
|
+
@klass.get(path, @params).tap do |result|
|
19
|
+
@cached_result = result if @params.blank?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/mno_enterprise/core.rb
CHANGED
@@ -17,6 +17,7 @@ require "her_extension/model/parse"
|
|
17
17
|
require "her_extension/model/associations/association"
|
18
18
|
require "her_extension/model/associations/association_proxy"
|
19
19
|
require "her_extension/model/associations/has_many_association"
|
20
|
+
require "her_extension/model/associations/belongs_to_association"
|
20
21
|
require "her_extension/middleware/mnoe_api_v1_parse_json"
|
21
22
|
require "her_extension/middleware/mnoe_raise_error"
|
22
23
|
require "faraday_middleware"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mno-enterprise-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arnaud Lachaume
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-09-
|
12
|
+
date: 2016-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -316,6 +316,7 @@ files:
|
|
316
316
|
- lib/her_extension/middleware/mnoe_raise_error.rb
|
317
317
|
- lib/her_extension/model/associations/association.rb
|
318
318
|
- lib/her_extension/model/associations/association_proxy.rb
|
319
|
+
- lib/her_extension/model/associations/belongs_to_association.rb
|
319
320
|
- lib/her_extension/model/associations/has_many_association.rb
|
320
321
|
- lib/her_extension/model/attributes.rb
|
321
322
|
- lib/her_extension/model/orm.rb
|
@@ -402,7 +403,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
402
403
|
version: '0'
|
403
404
|
requirements: []
|
404
405
|
rubyforge_project:
|
405
|
-
rubygems_version: 2.
|
406
|
+
rubygems_version: 2.5.1
|
406
407
|
signing_key:
|
407
408
|
specification_version: 4
|
408
409
|
summary: Maestrano Enterprise - Core functionnality
|