diff --git a/.travis.yml b/.travis.yml index 976d8ee1..3a9b42bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,8 @@ matrix: env: RAILS_VERSION=5.1 SEQUEL_VERSION=5.0 - rvm: 2.6.0 env: RAILS_VERSION=5.2 SEQUEL_VERSION=5.0 + - rvm: 2.7.0 + env: RAILS_VERSION=5.2 SEQUEL_VERSION=5.0 before_install: - wget http://api-key-dealer.herokuapp.com/clients/algolia-keys && chmod +x algolia-keys diff --git a/ChangeLog b/ChangeLog index 44b6d83d..9b7b9745 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ # CHANGELOG +## [1.24.1](https://github.com/algolia/algoliasearch-rails/releases/tag/1.24.1) (2020-07-15) + +**Fixed** + +* Fixes ruby warning 'Proc.new is deprecated' + +## [1.24.0](https://github.com/algolia/algoliasearch-rails/releases/tag/1.24.0) (2020-02-21) + +**Added** + +* Adds indexLanguages in index settings + ## [1.23.2](https://github.com/algolia/algoliasearch-rails/releases/tag/1.23.2) (2019-06-26) **Fixed** diff --git a/README.md b/README.md index a78e0f19..3e1bd875 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Community Forum • Stack Overflow • Report a bug • + FAQ • Support
@@ -82,6 +83,8 @@ You can find the full reference on [Algolia's website](https://www.algolia.com/d 1. **[Testing](#testing)** * [Notes](#notes) +1. **[Troubleshooting](#troubleshooting)** + * [Frequently asked questions](#frequently-asked-questions) @@ -1182,3 +1185,11 @@ end +# Troubleshooting + + +## Frequently asked questions + +Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/framework-integration/rails/troubleshooting/faq/) where you will find answers for the most common issues and gotchas with the gem. + + diff --git a/lib/algoliasearch-rails.rb b/lib/algoliasearch-rails.rb index 5c1caabc..95736514 100644 --- a/lib/algoliasearch-rails.rb +++ b/lib/algoliasearch-rails.rb @@ -68,7 +68,7 @@ class IndexSettings :disableTypoToleranceOnAttributes, :disableTypoToleranceOnWords, :separatorsToIndex, # Language :ignorePlurals, :removeStopWords, :camelCaseAttributes, :decompoundedAttributes, - :keepDiacriticsOnCharacters, :queryLanguages, + :keepDiacriticsOnCharacters, :queryLanguages, :indexLanguages, # Query Rules :enableRules, # Query Strategy @@ -90,9 +90,9 @@ class IndexSettings end end - def initialize(options, block) + def initialize(options, &block) @options = options - instance_exec(&block) if block + instance_exec(&block) if block_given? end def use_serializer(serializer) @@ -252,12 +252,14 @@ def to_settings settings[:slaves] = additional_indexes.select { |opts, s| opts[:slave] }.map do |opts, s| name = opts[:index_name] name = "#{name}_#{Rails.env.to_s}" if opts[:per_environment] + name = "virtual(#{name})" if opts[:virtual] name end settings.delete(:slaves) if settings[:slaves].empty? settings[:replicas] = additional_indexes.select { |opts, s| opts[:replica] }.map do |opts, s| name = opts[:index_name] name = "#{name}_#{Rails.env.to_s}" if opts[:per_environment] + name = "virtual(#{name})" if opts[:virtual] name end settings.delete(:replicas) if settings[:replicas].empty? @@ -272,7 +274,7 @@ def add_index(index_name, options = {}, &block) @additional_indexes ||= {} 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] }) options[:index_name] = index_name - @additional_indexes[options] = IndexSettings.new(options, Proc.new) + @additional_indexes[options] = IndexSettings.new(options, &block) end def add_replica(index_name, options = {}, &block) @@ -389,7 +391,7 @@ class <