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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 367857f778e2792b591dff3358f722c8ec514e4e
4
- data.tar.gz: 2ac98e9a282fbc1d61c914ec8a9795cdc798372b
3
+ metadata.gz: e90128e9d7f2fba2eace315fe74fc64f5bae2697
4
+ data.tar.gz: d3cc2b9c4a717af5a2e161e8de4ed57f94d8d089
5
5
  SHA512:
6
- metadata.gz: 13e20c1edaf97ff676740c706de91455e4062bf0b12abb8a9e90b27b73538fe978d34871645e14d5568f885d8c26c8e349267ddd3c4300c4247f5d52de216e71
7
- data.tar.gz: b108de4df0ad056798c6d7407fa71b7437188749f6479c148bfbc5701baac768092059b842789534fd5e4594df5b3a32fdb0b687db3b01dc46b214587982546e
6
+ metadata.gz: bdc56f2cff4774c20d42ec2f7b25fbd775a263ca2dd32f8d47665488e6c96b5e590343c1bbdfae4b7436b88d1667175258ca20621d13bbbfa1273fa47ecc228c
7
+ data.tar.gz: 619d02707e0a92fcc7757506175171b9c83218c171e9a176c6f65b037e59b3aec6e8bb1e886ea9276d5c0efacd4771e903e9e7268d19751851903dc5f927d820
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
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.3 ruby lib
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.3"
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
- reverse_relationship_name = self.name.downcase unless reverse_relationship_name
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
- when ActiveRecord::Reflection::HasManyReflection, ActiveRecord::Reflection::HasManyThroughAssociation
112
+ when ActiveRecord::Reflection::HasManyReflection, ActiveRecord::Reflection::ThroughReflection,
113
+ ActiveRecord::Reflection::HasAndBelongsToManyReflection
105
114
  :plural
106
115
  else
107
116
  :singular
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-rails-dynamic-json-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Song Yangyu