algoliasearch-rails 1.23.2 → 1.26.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
2
  SHA256:
3
- metadata.gz: 7ac9c6a0bf5ab646bcde8da6a321cab385e1875e258e5a2f2e50120ae7fbd9f0
4
- data.tar.gz: 1aef47abb42a2e5cf0fa5201560523c73a44488c763b38b6ad3ad82e55337340
3
+ metadata.gz: 6e7605f49088d6e5dad323c990b8419c9bd61a19189ee875d59a1b3b9c70c350
4
+ data.tar.gz: 3352a8e76be0c0f1bd25e77a151bec3bb594535effdf4fbe0d6c43c038ade8b4
5
5
  SHA512:
6
- metadata.gz: 0e4a6e309538e45b67b32b53f041b217cb249fd7dce3a61158b4d256a7d984a1d6b8bdddee38bc5665ff3721c1fdc62042037b385b2a86d0773e84c921abc0ed
7
- data.tar.gz: 2dfd9c286a3a12b2a9ca37f0d29669abb5a6454a3368f0c8a0265fed5155c6f3af8f727ec5552ea334b955c78f6dc16918c99ba7db7d54adbe66cd1c84f47db1
6
+ metadata.gz: ab287068f7733e21e9765ee0757c35e1300c5a5a04c227473ad0839935f9eb7d4e1c93a69180605b49f7ebf936bb19029e6c9ecc5e9b431c8b7dcef7c78d7224
7
+ data.tar.gz: b9e3a0aa8dfbbd213fb02443933407ec74b3a1b2bc0013e90e83171fd06b42d76938bd450fb4fe90e5e39d8d78b6c29cbc70eae2bfc1c5736cf19d09d8a6042e
data/.travis.yml CHANGED
@@ -8,6 +8,7 @@ matrix:
8
8
  include:
9
9
  - rvm: 1.8.7
10
10
  env: RAILS_VERSION=3.2.0 SEQUEL_VERSION=4.0
11
+ dist: trusty
11
12
  - rvm: 1.9.3
12
13
  env: RAILS_VERSION=3.2.0
13
14
  - rvm: 1.9.3
@@ -32,8 +33,16 @@ matrix:
32
33
  env: RAILS_VERSION=5.1 SEQUEL_VERSION=5.0
33
34
  - rvm: 2.5.3
34
35
  env: RAILS_VERSION=5.1 SEQUEL_VERSION=5.0
36
+ - rvm: 2.5.3
37
+ env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
38
+ - rvm: 2.6.0
39
+ env: RAILS_VERSION=5.2 SEQUEL_VERSION=5.0
35
40
  - rvm: 2.6.0
41
+ env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
42
+ - rvm: 2.7.0
36
43
  env: RAILS_VERSION=5.2 SEQUEL_VERSION=5.0
44
+ - rvm: 2.7.0
45
+ env: RAILS_VERSION=6.0 SEQUEL_VERSION=5.0
37
46
 
38
47
  before_install:
39
48
  - wget http://api-key-dealer.herokuapp.com/clients/algolia-keys && chmod +x algolia-keys
@@ -1,5 +1,34 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## [Unreleased](https://github.com/algolia/algoliasearch-rails/compare/1.26.0...master)
4
+
5
+ ## [1.26.0](https://github.com/algolia/algoliasearch-rails/compare/1.25.0...1.26.0) (2021-09-03)
6
+
7
+ ### Added
8
+
9
+ - Implement virtual replicas ([#409](https://github.com/algolia/algoliasearch-rails/pull/409))
10
+
11
+ ## [1.25.0](https://github.com/algolia/algoliasearch-rails/compare/1.24.1...1.25.0) (2020-11-24)
12
+
13
+ ### Added
14
+ - Pass array argument to geoloc ([#372](https://github.com/algolia/algoliasearch-rails/pull/372))
15
+ - Containerize the repo ([#391](https://github.com/algolia/algoliasearch-rails/pull/391))
16
+
17
+ ### Fixed
18
+ - Use Zeitwerk for loading models in Rails 6 ([#364](https://github.com/algolia/algoliasearch-rails/pull/364))
19
+
20
+ ## [1.24.1](https://github.com/algolia/algoliasearch-rails/releases/tag/1.24.1) (2020-07-15)
21
+
22
+ **Fixed**
23
+
24
+ * Fixes ruby warning 'Proc.new is deprecated'
25
+
26
+ ## [1.24.0](https://github.com/algolia/algoliasearch-rails/releases/tag/1.24.0) (2020-02-21)
27
+
28
+ **Added**
29
+
30
+ * Adds indexLanguages in index settings
31
+
3
32
  ## [1.23.2](https://github.com/algolia/algoliasearch-rails/releases/tag/1.23.2) (2019-06-26)
4
33
 
5
34
  **Fixed**
data/Gemfile CHANGED
@@ -8,8 +8,8 @@ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
8
8
  end
9
9
 
10
10
  group :test do
11
- rails_version = ENV["RAILS_VERSION"] ? "~> #{ENV["RAILS_VERSION"]}" : '>= 3.2.0'
12
- gem 'rails', rails_version
11
+ rails_version = ENV["RAILS_VERSION"] || '5.2'
12
+ gem 'rails', "~> #{rails_version}"
13
13
  gem 'active_model_serializers'
14
14
  if defined?(RUBY_VERSION) && RUBY_VERSION == "1.8.7"
15
15
  gem 'i18n', '< 0.7'
@@ -34,8 +34,12 @@ group :test do
34
34
  Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1')
35
35
  gem 'net-http-persistent', '< 3.0'
36
36
  end
37
+ if Gem::Version.new(rails_version) >= Gem::Version.new('6.0')
38
+ gem 'sqlite3', '~> 1.4.0', :platform => [:rbx, :ruby]
39
+ else
40
+ gem 'sqlite3', '< 1.4.0', :platform => [:rbx, :ruby]
41
+ end
37
42
  gem 'rspec', '>= 2.5.0', '< 3.0'
38
- gem 'sqlite3', '< 1.4.0', :platform => [:rbx, :ruby]
39
43
  gem 'jdbc-sqlite3', :platform => :jruby
40
44
  gem 'activerecord-jdbc-adapter', :platform => :jruby
41
45
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
data/Gemfile.lock CHANGED
@@ -1,72 +1,72 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actioncable (5.2.3)
5
- actionpack (= 5.2.3)
4
+ actioncable (5.2.2)
5
+ actionpack (= 5.2.2)
6
6
  nio4r (~> 2.0)
7
7
  websocket-driver (>= 0.6.1)
8
- actionmailer (5.2.3)
9
- actionpack (= 5.2.3)
10
- actionview (= 5.2.3)
11
- activejob (= 5.2.3)
8
+ actionmailer (5.2.2)
9
+ actionpack (= 5.2.2)
10
+ actionview (= 5.2.2)
11
+ activejob (= 5.2.2)
12
12
  mail (~> 2.5, >= 2.5.4)
13
13
  rails-dom-testing (~> 2.0)
14
- actionpack (5.2.3)
15
- actionview (= 5.2.3)
16
- activesupport (= 5.2.3)
14
+ actionpack (5.2.2)
15
+ actionview (= 5.2.2)
16
+ activesupport (= 5.2.2)
17
17
  rack (~> 2.0)
18
18
  rack-test (>= 0.6.3)
19
19
  rails-dom-testing (~> 2.0)
20
20
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
21
- actionview (5.2.3)
22
- activesupport (= 5.2.3)
21
+ actionview (5.2.2)
22
+ activesupport (= 5.2.2)
23
23
  builder (~> 3.1)
24
24
  erubi (~> 1.4)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
27
- active_model_serializers (0.10.9)
27
+ active_model_serializers (0.10.8)
28
28
  actionpack (>= 4.1, < 6)
29
29
  activemodel (>= 4.1, < 6)
30
30
  case_transform (>= 0.2)
31
31
  jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
32
- activejob (5.2.3)
33
- activesupport (= 5.2.3)
32
+ activejob (5.2.2)
33
+ activesupport (= 5.2.2)
34
34
  globalid (>= 0.3.6)
35
- activemodel (5.2.3)
36
- activesupport (= 5.2.3)
37
- activerecord (5.2.3)
38
- activemodel (= 5.2.3)
39
- activesupport (= 5.2.3)
35
+ activemodel (5.2.2)
36
+ activesupport (= 5.2.2)
37
+ activerecord (5.2.2)
38
+ activemodel (= 5.2.2)
39
+ activesupport (= 5.2.2)
40
40
  arel (>= 9.0)
41
- activestorage (5.2.3)
42
- actionpack (= 5.2.3)
43
- activerecord (= 5.2.3)
41
+ activestorage (5.2.2)
42
+ actionpack (= 5.2.2)
43
+ activerecord (= 5.2.2)
44
44
  marcel (~> 0.3.1)
45
- activesupport (5.2.3)
45
+ activesupport (5.2.2)
46
46
  concurrent-ruby (~> 1.0, >= 1.0.2)
47
47
  i18n (>= 0.7, < 2)
48
48
  minitest (~> 5.1)
49
49
  tzinfo (~> 1.1)
50
50
  addressable (2.4.0)
51
- algoliasearch (1.26.0)
51
+ algoliasearch (1.27.4)
52
52
  httpclient (~> 2.8, >= 2.8.3)
53
53
  json (>= 1.5.1)
54
54
  arel (9.0.0)
55
- backports (3.15.0)
55
+ backports (3.11.4)
56
56
  builder (3.2.3)
57
57
  case_transform (0.2)
58
58
  activesupport
59
- concurrent-ruby (1.1.5)
59
+ concurrent-ruby (1.1.4)
60
60
  crass (1.0.4)
61
61
  diff-lcs (1.3)
62
62
  erubi (1.8.0)
63
- ethon (0.12.0)
63
+ ethon (0.11.0)
64
64
  ffi (>= 1.3.0)
65
65
  faraday (0.15.4)
66
66
  multipart-post (>= 1.2, < 3)
67
- faraday_middleware (0.13.1)
67
+ faraday_middleware (0.12.2)
68
68
  faraday (>= 0.7.4, < 1.0)
69
- ffi (1.11.1)
69
+ ffi (1.9.25)
70
70
  gh (0.15.1)
71
71
  addressable (~> 2.4.0)
72
72
  backports
@@ -74,14 +74,14 @@ GEM
74
74
  multi_json (~> 1.0)
75
75
  net-http-persistent (~> 2.9)
76
76
  net-http-pipeline
77
- globalid (0.4.2)
77
+ globalid (0.4.1)
78
78
  activesupport (>= 4.2.0)
79
79
  highline (1.7.10)
80
80
  httpclient (2.8.3)
81
- i18n (1.6.0)
81
+ i18n (1.4.0)
82
82
  concurrent-ruby (~> 1.0)
83
83
  json (1.8.6)
84
- jsonapi-renderer (0.2.2)
84
+ jsonapi-renderer (0.2.0)
85
85
  kaminari (1.1.1)
86
86
  activesupport (>= 4.1.0)
87
87
  kaminari-actionview (= 1.1.1)
@@ -109,39 +109,39 @@ GEM
109
109
  mini_portile2 (2.4.0)
110
110
  minitest (5.11.3)
111
111
  multi_json (1.13.1)
112
- multipart-post (2.1.1)
112
+ multipart-post (2.0.0)
113
113
  net-http-persistent (2.9.4)
114
114
  net-http-pipeline (1.0.1)
115
115
  nio4r (2.3.1)
116
- nokogiri (1.10.3)
116
+ nokogiri (1.9.1)
117
117
  mini_portile2 (~> 2.4.0)
118
118
  pusher-client (0.6.2)
119
119
  json
120
120
  websocket (~> 1.0)
121
- rack (2.0.7)
121
+ rack (2.0.6)
122
122
  rack-test (1.1.0)
123
123
  rack (>= 1.0, < 3)
124
- rails (5.2.3)
125
- actioncable (= 5.2.3)
126
- actionmailer (= 5.2.3)
127
- actionpack (= 5.2.3)
128
- actionview (= 5.2.3)
129
- activejob (= 5.2.3)
130
- activemodel (= 5.2.3)
131
- activerecord (= 5.2.3)
132
- activestorage (= 5.2.3)
133
- activesupport (= 5.2.3)
124
+ rails (5.2.2)
125
+ actioncable (= 5.2.2)
126
+ actionmailer (= 5.2.2)
127
+ actionpack (= 5.2.2)
128
+ actionview (= 5.2.2)
129
+ activejob (= 5.2.2)
130
+ activemodel (= 5.2.2)
131
+ activerecord (= 5.2.2)
132
+ activestorage (= 5.2.2)
133
+ activesupport (= 5.2.2)
134
134
  bundler (>= 1.3.0)
135
- railties (= 5.2.3)
135
+ railties (= 5.2.2)
136
136
  sprockets-rails (>= 2.0.0)
137
137
  rails-dom-testing (2.0.3)
138
138
  activesupport (>= 4.2.0)
139
139
  nokogiri (>= 1.6)
140
140
  rails-html-sanitizer (1.0.4)
141
141
  loofah (~> 2.2, >= 2.2.2)
142
- railties (5.2.3)
143
- actionpack (= 5.2.3)
144
- activesupport (= 5.2.3)
142
+ railties (5.2.2)
143
+ actionpack (= 5.2.2)
144
+ activesupport (= 5.2.2)
145
145
  method_source
146
146
  rake (>= 0.8.7)
147
147
  thor (>= 0.19.0, < 2.0)
@@ -156,7 +156,7 @@ GEM
156
156
  rspec-expectations (2.99.2)
157
157
  diff-lcs (>= 1.1.3, < 2.0)
158
158
  rspec-mocks (2.99.4)
159
- sequel (5.21.0)
159
+ sequel (5.16.0)
160
160
  sprockets (3.7.2)
161
161
  concurrent-ruby (~> 1.0)
162
162
  rack (> 1, < 3)
@@ -167,7 +167,7 @@ GEM
167
167
  sqlite3 (1.3.13)
168
168
  thor (0.20.3)
169
169
  thread_safe (0.3.6)
170
- travis (1.8.10)
170
+ travis (1.8.9)
171
171
  backports
172
172
  faraday (~> 0.9)
173
173
  faraday_middleware (~> 0.9, >= 0.9.1)
@@ -181,10 +181,10 @@ GEM
181
181
  tzinfo (1.2.5)
182
182
  thread_safe (~> 0.1)
183
183
  websocket (1.2.8)
184
- websocket-driver (0.7.1)
184
+ websocket-driver (0.7.0)
185
185
  websocket-extensions (>= 0.1.0)
186
- websocket-extensions (0.1.4)
187
- will_paginate (3.1.7)
186
+ websocket-extensions (0.1.3)
187
+ will_paginate (3.1.6)
188
188
 
189
189
  PLATFORMS
190
190
  ruby
@@ -197,7 +197,7 @@ DEPENDENCIES
197
197
  jdbc-sqlite3
198
198
  json (~> 1.8, >= 1.8.6)
199
199
  kaminari
200
- rails (>= 3.2.0)
200
+ rails (~> 5.2)
201
201
  rake (~> 10.1.0)
202
202
  rdoc
203
203
  redgreen
@@ -208,4 +208,4 @@ DEPENDENCIES
208
208
  will_paginate (>= 2.3.15)
209
209
 
210
210
  BUNDLED WITH
211
- 2.0.1
211
+ 1.17.2
data/README.md CHANGED
@@ -1,9 +1,28 @@
1
-
2
- # Algolia Search API Client for Rails
3
-
4
- [Algolia Search](https://www.algolia.com) is a hosted search engine capable of delivering real-time results from the first keystroke.
5
-
6
- [![Build Status](https://travis-ci.org/algolia/algoliasearch-rails.svg?branch=master)](https://travis-ci.org/algolia/algoliasearch-rails) [![Gem Version](https://badge.fury.io/rb/algoliasearch-rails.svg)](http://badge.fury.io/rb/algoliasearch-rails) [![Code Climate](https://codeclimate.com/github/algolia/algoliasearch-rails.svg)](https://codeclimate.com/github/algolia/algoliasearch-rails) ![ActiveRecord](https://img.shields.io/badge/ActiveRecord-yes-blue.svg?style=flat-square) ![Mongoid](https://img.shields.io/badge/Mongoid-yes-blue.svg?style=flat-square) ![Sequel](https://img.shields.io/badge/Sequel-yes-blue.svg?style=flat-square)
1
+ <p align="center">
2
+ <a href="https://www.algolia.com">
3
+ <img alt="Algolia for Rails" src="https://raw.githubusercontent.com/algolia/algoliasearch-client-common/master/banners/rails.png" >
4
+ </a>
5
+
6
+ <h4 align="center">The perfect starting point to integrate <a href="https://algolia.com" target="_blank">Algolia</a> within your Rails project</h4>
7
+
8
+ <p align="center">
9
+ <a href="https://circleci.com/gh/algolia/algoliasearch-rails"><img src="https://circleci.com/gh/algolia/algoliasearch-rails.svg?style=shield" alt="CircleCI" /></a>
10
+ <a href="http://badge.fury.io/rb/algoliasearch-rails"><img src="https://badge.fury.io/rb/algoliasearch-rails.svg" alt="Gem Version"></img></a>
11
+ <a href="https://codeclimate.com/github/algolia/algoliasearch-rails"><img src="https://codeclimate.com/github/algolia/algoliasearch-rails.svg" alt="Code Climate"></img></a>
12
+ <img src="https://img.shields.io/badge/ActiveRecord-yes-blue.svg?style=flat-square" alt="ActiveRecord"></img>
13
+ <img src="https://img.shields.io/badge/Mongoid-yes-blue.svg?style=flat-square" alt="Mongoid"></img>
14
+ <img src="https://img.shields.io/badge/Sequel-yes-blue.svg?style=flat-square" alt="Sequel"></img>
15
+ </p>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="https://www.algolia.com/doc/framework-integration/rails/getting-started/setup/?language=ruby" target="_blank">Documentation</a> •
20
+ <a href="https://discourse.algolia.com" target="_blank">Community Forum</a> •
21
+ <a href="http://stackoverflow.com/questions/tagged/algolia" target="_blank">Stack Overflow</a> •
22
+ <a href="https://github.com/algolia/algoliasearch-rails/issues" target="_blank">Report a bug</a> •
23
+ <a href="https://www.algolia.com/doc/framework-integration/rails/troubleshooting/faq/" target="_blank">FAQ</a> •
24
+ <a href="https://www.algolia.com/support" target="_blank">Support</a>
25
+ </p>
7
26
 
8
27
 
9
28
  This gem let you easily integrate the Algolia Search API to your favorite ORM. It's based on the [algoliasearch-client-ruby](https://github.com/algolia/algoliasearch-client-ruby) gem.
@@ -64,6 +83,8 @@ You can find the full reference on [Algolia's website](https://www.algolia.com/d
64
83
  1. **[Testing](#testing)**
65
84
  * [Notes](#notes)
66
85
 
86
+ 1. **[Troubleshooting](#troubleshooting)**
87
+ * [Frequently asked questions](#frequently-asked-questions)
67
88
 
68
89
 
69
90
 
@@ -142,7 +163,7 @@ class Contact < ActiveRecord::Base
142
163
  include AlgoliaSearch
143
164
 
144
165
  algoliasearch do
145
- attribute :first_name, :last_name, :email
166
+ attributes :first_name, :last_name, :email
146
167
  end
147
168
  end
148
169
  ```
@@ -1163,4 +1184,11 @@ end
1163
1184
  ```
1164
1185
 
1165
1186
 
1187
+ ## ❓ Troubleshooting
1188
+
1189
+ Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/ruby/) where you will find answers for the most common issues and gotchas with the client.
1190
+
1191
+ ## Use the Dockerfile
1192
+
1193
+ If you want to contribute to this project without installing all its dependencies, you can use our Docker image. Please check our [dedicated guide](DOCKER_README.MD) to learn more.
1166
1194
 
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.description = "AlgoliaSearch integration to your favorite ORM"
15
15
  s.email = "contact@algolia.com"
16
16
  s.extra_rdoc_files = [
17
- "ChangeLog",
17
+ "CHANGELOG.MD",
18
18
  "LICENSE",
19
19
  "README.md"
20
20
  ]
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
22
22
  ".document",
23
23
  ".rspec",
24
24
  ".travis.yml",
25
- "ChangeLog",
25
+ "CHANGELOG.MD",
26
26
  "Gemfile",
27
27
  "Gemfile.lock",
28
28
  "LICENSE",
@@ -6,7 +6,7 @@ module AlgoliaSearch
6
6
 
7
7
  def configuration=(configuration)
8
8
  @@configuration = configuration.merge(
9
- :user_agent => "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{Rails::VERSION})"
9
+ :user_agent => "Algolia for Rails (#{AlgoliaSearch::VERSION}); Rails (#{Rails::VERSION::STRING})"
10
10
  )
11
11
  Algolia.init @@configuration
12
12
  end
@@ -9,7 +9,7 @@ module AlgoliaSearch
9
9
  class Kaminari < ::Kaminari::PaginatableArray
10
10
 
11
11
  def initialize(array, options)
12
- super(array, options)
12
+ super(array, **options)
13
13
  end
14
14
 
15
15
  def limit(num)
@@ -2,7 +2,11 @@ module AlgoliaSearch
2
2
  module Utilities
3
3
  class << self
4
4
  def get_model_classes
5
- Rails.application.eager_load! if Rails.application # Ensure all models are loaded (not necessary in production when cache_classes is true).
5
+ if Rails.application && defined?(Rails.autoloaders) && Rails.autoloaders.zeitwerk_enabled?
6
+ Zeitwerk::Loader.eager_load_all
7
+ elsif Rails.application
8
+ Rails.application.eager_load!
9
+ end
6
10
  AlgoliaSearch.instance_variable_get :@included_in
7
11
  end
8
12
 
@@ -1,3 +1,3 @@
1
1
  module AlgoliaSearch
2
- VERSION = '1.23.2'
2
+ VERSION = '1.26.0'
3
3
  end
@@ -68,7 +68,7 @@ module AlgoliaSearch
68
68
  :disableTypoToleranceOnAttributes, :disableTypoToleranceOnWords, :separatorsToIndex,
69
69
  # Language
70
70
  :ignorePlurals, :removeStopWords, :camelCaseAttributes, :decompoundedAttributes,
71
- :keepDiacriticsOnCharacters, :queryLanguages,
71
+ :keepDiacriticsOnCharacters, :queryLanguages, :indexLanguages,
72
72
  # Query Rules
73
73
  :enableRules,
74
74
  # Query Strategy
@@ -90,9 +90,9 @@ module AlgoliaSearch
90
90
  end
91
91
  end
92
92
 
93
- def initialize(options, block)
93
+ def initialize(options, &block)
94
94
  @options = options
95
- instance_exec(&block) if block
95
+ instance_exec(&block) if block_given?
96
96
  end
97
97
 
98
98
  def use_serializer(serializer)
@@ -223,10 +223,10 @@ module AlgoliaSearch
223
223
  end
224
224
  end
225
225
 
226
- def geoloc(lat_attr, lng_attr)
226
+ def geoloc(lat_attr = nil, lng_attr = nil, &block)
227
227
  raise ArgumentError.new('Cannot specify additional attributes on a replica index') if @options[:slave] || @options[:replica]
228
228
  add_attribute :_geoloc do |o|
229
- { :lat => o.send(lat_attr).to_f, :lng => o.send(lng_attr).to_f }
229
+ block_given? ? o.instance_eval(&block) : { :lat => o.send(lat_attr).to_f, :lng => o.send(lng_attr).to_f }
230
230
  end
231
231
  end
232
232
 
@@ -252,12 +252,14 @@ module AlgoliaSearch
252
252
  settings[:slaves] = additional_indexes.select { |opts, s| opts[:slave] }.map do |opts, s|
253
253
  name = opts[:index_name]
254
254
  name = "#{name}_#{Rails.env.to_s}" if opts[:per_environment]
255
+ name = "virtual(#{name})" if opts[:virtual]
255
256
  name
256
257
  end
257
258
  settings.delete(:slaves) if settings[:slaves].empty?
258
259
  settings[:replicas] = additional_indexes.select { |opts, s| opts[:replica] }.map do |opts, s|
259
260
  name = opts[:index_name]
260
261
  name = "#{name}_#{Rails.env.to_s}" if opts[:per_environment]
262
+ name = "virtual(#{name})" if opts[:virtual]
261
263
  name
262
264
  end
263
265
  settings.delete(:replicas) if settings[:replicas].empty?
@@ -272,7 +274,7 @@ module AlgoliaSearch
272
274
  @additional_indexes ||= {}
273
275
  raise MixedSlavesAndReplicas.new('Cannot mix slaves and replicas in the same configuration (add_slave is deprecated)') if (options[:slave] && @additional_indexes.any? { |opts, _| opts[:replica] }) || (options[:replica] && @additional_indexes.any? { |opts, _| opts[:slave] })
274
276
  options[:index_name] = index_name
275
- @additional_indexes[options] = IndexSettings.new(options, Proc.new)
277
+ @additional_indexes[options] = IndexSettings.new(options, &block)
276
278
  end
277
279
 
278
280
  def add_replica(index_name, options = {}, &block)
@@ -389,7 +391,7 @@ module AlgoliaSearch
389
391
  end
390
392
 
391
393
  def algoliasearch(options = {}, &block)
392
- self.algoliasearch_settings = IndexSettings.new(options, block_given? ? Proc.new : nil)
394
+ self.algoliasearch_settings = IndexSettings.new(options, &block)
393
395
  self.algoliasearch_options = { :type => algolia_full_const_get(model_name.to_s), :per_page => algoliasearch_settings.get_setting(:hitsPerPage) || 10, :page => 1 }.merge(options)
394
396
 
395
397
  attr_accessor :highlight_result, :snippet_result
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: algoliasearch-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.23.2
4
+ version: 1.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Algolia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2021-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -119,14 +119,14 @@ email: contact@algolia.com
119
119
  executables: []
120
120
  extensions: []
121
121
  extra_rdoc_files:
122
- - ChangeLog
122
+ - CHANGELOG.MD
123
123
  - LICENSE
124
124
  - README.md
125
125
  files:
126
126
  - ".document"
127
127
  - ".rspec"
128
128
  - ".travis.yml"
129
- - ChangeLog
129
+ - CHANGELOG.MD
130
130
  - Gemfile
131
131
  - Gemfile.lock
132
132
  - LICENSE
@@ -173,7 +173,7 @@ homepage: http://github.com/algolia/algoliasearch-rails
173
173
  licenses:
174
174
  - MIT
175
175
  metadata: {}
176
- post_install_message:
176
+ post_install_message:
177
177
  rdoc_options: []
178
178
  require_paths:
179
179
  - lib
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  version: '0'
190
190
  requirements: []
191
191
  rubygems_version: 3.0.3
192
- signing_key:
192
+ signing_key:
193
193
  specification_version: 4
194
194
  summary: AlgoliaSearch integration to your favorite ORM
195
195
  test_files: []