elasticsearch-persistence 5.0.2 → 5.1.0
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dad7450ff0696099a095419ee12da5d4ea875646ad591545f95bae8fc2408ce2
|
4
|
+
data.tar.gz: 339a759ce92884321d4adbb7fa63f4ee3a155958d97e5ea3ee8c55b60cd21e8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a1477b512b7cdbb812866c7b582e1417871713689c165d876b49df44e7d8095d08d7b5993110b23071d784f9c9c19db6d58a771bd0b1627d1f9c75bd75586ed
|
7
|
+
data.tar.gz: 7eb56ed82336e9648a0fe3a3288c854621811f13b07ee6402138086c4dfe28fd78b4f283b4a0ea1a140678d8f625794c6aad3c386cfa346eec017b92ee007a06
|
data/README.md
CHANGED
@@ -445,6 +445,9 @@ and demonstrates a rich set of features:
|
|
445
445
|
|
446
446
|
### The ActiveRecord Pattern
|
447
447
|
|
448
|
+
Please note that this pattern is deprecated and will be removed in version 6.0.
|
449
|
+
The [Repository Pattern](#the-repository-pattern) is recommended instead.
|
450
|
+
|
448
451
|
The `Elasticsearch::Persistence::Model` module provides an implementation of the
|
449
452
|
active record [pattern](http://www.martinfowler.com/eaaCatalog/activeRecord.html),
|
450
453
|
with a familiar interface for using Elasticsearch as a persistence layer in
|
@@ -66,6 +66,22 @@ module Elasticsearch
|
|
66
66
|
@gateway
|
67
67
|
end
|
68
68
|
|
69
|
+
DEPRECATION_WARNING = "This (ActiveRecord) persistence pattern is deprecated. It will be removed in " +
|
70
|
+
"version 6.0 in favor of the Repository pattern. Please see the ReadMe for " +
|
71
|
+
"details on the alternative pattern.\n" +
|
72
|
+
"https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-persistence" +
|
73
|
+
"#the-repository-pattern".freeze
|
74
|
+
|
75
|
+
# Warn that this ActiveRecord persistence pattern is deprecated.
|
76
|
+
#
|
77
|
+
def raise_deprecation_warning!
|
78
|
+
if STDERR.tty?
|
79
|
+
Kernel.warn("\e[31;1m#{DEPRECATION_WARNING}\e[0m")
|
80
|
+
else
|
81
|
+
Kernel.warn(DEPRECATION_WARNING)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
69
85
|
# Delegate methods to repository
|
70
86
|
#
|
71
87
|
delegate :settings,
|
@@ -126,6 +142,8 @@ module Elasticsearch
|
|
126
142
|
attribute :updated_at, Time, default: lambda { |o,a| Time.now.utc }
|
127
143
|
|
128
144
|
attr_reader :hit
|
145
|
+
|
146
|
+
raise_deprecation_warning!
|
129
147
|
end
|
130
148
|
|
131
149
|
end
|
@@ -33,6 +33,11 @@ module Elasticsearch
|
|
33
33
|
Person.create_index! force: true
|
34
34
|
end
|
35
35
|
|
36
|
+
should "warn that the ActiveRecord persistence pattern is deprecated" do
|
37
|
+
Kernel.expects(:warn).at_least_once
|
38
|
+
class ShouldWarn; include Elasticsearch::Persistence::Model; end
|
39
|
+
end
|
40
|
+
|
36
41
|
should "save the object with custom ID" do
|
37
42
|
person = Person.new id: 1, name: 'Number One'
|
38
43
|
person.save
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-persistence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karel Minarik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: elasticsearch
|
@@ -412,7 +412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
412
412
|
version: '0'
|
413
413
|
requirements: []
|
414
414
|
rubyforge_project:
|
415
|
-
rubygems_version: 2.
|
415
|
+
rubygems_version: 2.7.6
|
416
416
|
signing_key:
|
417
417
|
specification_version: 4
|
418
418
|
summary: Persistence layer for Ruby models and Elasticsearch.
|