elasticsearch-rails-dynamic-json-support 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/elasticsearch-rails-dynamic-json-support.gemspec +2 -2
- data/lib/elasticsearch/model/cascade_update.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e90128e9d7f2fba2eace315fe74fc64f5bae2697
|
4
|
+
data.tar.gz: d3cc2b9c4a717af5a2e161e8de4ed57f94d8d089
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdc56f2cff4774c20d42ec2f7b25fbd775a263ca2dd32f8d47665488e6c96b5e590343c1bbdfae4b7436b88d1667175258ca20621d13bbbfa1273fa47ecc228c
|
7
|
+
data.tar.gz: 619d02707e0a92fcc7757506175171b9c83218c171e9a176c6f65b037e59b3aec6e8bb1e886ea9276d5c0efacd4771e903e9e7268d19751851903dc5f927d820
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: elasticsearch-rails-dynamic-json-support 0.0.
|
5
|
+
# stub: elasticsearch-rails-dynamic-json-support 0.0.4 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "elasticsearch-rails-dynamic-json-support".freeze
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.4"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
@@ -60,9 +60,17 @@ module Elasticsearch
|
|
60
60
|
return json_relationship_registry[key_name] unless blk
|
61
61
|
|
62
62
|
relationship_name = key_name unless relationship_name
|
63
|
-
|
63
|
+
relationship_name = relationship_name.to_s
|
64
|
+
|
65
|
+
reverse_relationship_name = self.name.demodulize.downcase unless reverse_relationship_name
|
66
|
+
reverse_relationship_name = reverse_relationship_name.to_s
|
64
67
|
|
65
68
|
reflection = reflect_on_association relationship_name
|
69
|
+
|
70
|
+
# The fail is safe since it's in the initialization process
|
71
|
+
# TODO: make the initializer to include the fail
|
72
|
+
fail "Reflection not found for #{relationship_name} from class: #{self.name}" unless reflection
|
73
|
+
|
66
74
|
reflected_class = reflection.class_name.constantize
|
67
75
|
|
68
76
|
actor = Actor.new relationship_name, get_singularity(reflection), blk
|
@@ -101,7 +109,8 @@ module Elasticsearch
|
|
101
109
|
|
102
110
|
def get_singularity(reflection)
|
103
111
|
case reflection
|
104
|
-
|
112
|
+
when ActiveRecord::Reflection::HasManyReflection, ActiveRecord::Reflection::ThroughReflection,
|
113
|
+
ActiveRecord::Reflection::HasAndBelongsToManyReflection
|
105
114
|
:plural
|
106
115
|
else
|
107
116
|
:singular
|