diff options
author | 2019-09-05 15:51:34 +0200 | |
---|---|---|
committer | 2019-09-05 15:51:34 +0200 | |
commit | c62bd4d5644a77d1224f188d092f39e0438062ec (patch) | |
tree | 8dc0d218c0dae45add04b1324111318048fa1105 /app/jobs/category_update_job.rb | |
parent | Added docker-compose.override.yml for development purposes (diff) | |
download | packages-5-c62bd4d5644a77d1224f188d092f39e0438062ec.tar.gz packages-5-c62bd4d5644a77d1224f188d092f39e0438062ec.tar.bz2 packages-5-c62bd4d5644a77d1224f188d092f39e0438062ec.zip |
Migrate to ES 7.3 and the repository pattern
Elasticsearch-persistence is used as the persistence layer for Ruby
domain objects in Elasticsearch in this application. So far, the
ActiveRecord pattern has been used here. However, this pattern
has been deprecated as of version 6 of the gem and was removed in
version 7. That's why the application has been migrated to use the
repository pattern instead.
For further information, please see:
https://www.elastic.co/blog/activerecord-to-repository-changing-
persistence-patterns-with-the-elasticsearch-rails-gem
Note: The old Elasticsearch index won't be compatible with this
version anymore. That's why a fresh index should be populated.
Signed-off-by: Max Magorsch <max@magorsch.de>
Diffstat (limited to 'app/jobs/category_update_job.rb')
-rw-r--r-- | app/jobs/category_update_job.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/jobs/category_update_job.rb b/app/jobs/category_update_job.rb index 7443099..e764ad8 100644 --- a/app/jobs/category_update_job.rb +++ b/app/jobs/category_update_job.rb @@ -5,8 +5,8 @@ class CategoryUpdateJob < ApplicationJob category_path, options = args model = Portage::Repository::Category.new(category_path) - category = Category.find_by(:name, model.name) || Category.new - idx_packages = Package.find_all_by(:category, model.name) || [] + category = CategoryRepository.find_by(:name, model.name) || Category.new + idx_packages = PackageRepository.find_all_by(:category, model.name) || [] if category.needs_import? model category.import! model |