good_job 2.9.1 → 2.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f99dea9840ebbfd8eda79dd1c06a94b7c9d8185835d6f9991e94d5a86fc5ffea
4
- data.tar.gz: 148b147b8f76c74f0362dcc8b26381631e1582eae4e7ab929021a291fa7d24fa
3
+ metadata.gz: 43a641edf5b6ff33dc8752874c6b317ad96bfd74ed4cbcb3a9bbeee7ff9c14cf
4
+ data.tar.gz: bfcf81a0d6c2d7bef01c3abdad9222fcc92cc8a5fd0ead3059fe5b9afd96aefa
5
5
  SHA512:
6
- metadata.gz: fe4926720862cb1e42581aa612b92c46ed9a00ea183b66a6c9ee4836165a7f77aa10b78ed32c80399bdc39189f76cd5f48e7b98e3b9b7da93b0de71c8b3cd0c7
7
- data.tar.gz: 1e47650d6bbdca91983bce0df607e4e4845cd26339d87798086a85f89be822987c2c41cfab08aba164f89195c55d10b3129e593b873b95dfb4075d452e3541c2
6
+ metadata.gz: ea801613572d4ccdce2af524303220eed9f50532ce80160c8fd9063bb994f0be725cf806d84aad8ea2bf5028f593a79fa13b5d1f7e796ece29eee70d42df9fa8
7
+ data.tar.gz: 9344d31ec8ffacdaa531a7e8bb7292270b151ad440d9dd95cd7ebfbe4106ca6b276ec3cff671df2ad97c9aee50892d453b584f948a7fc5e1bf7710fd935b2d40
data/CHANGELOG.md CHANGED
@@ -1,18 +1,33 @@
1
1
  # Changelog
2
2
 
3
+ ## [v2.9.2](https://github.com/bensheldon/good_job/tree/v2.9.2) (2022-01-19)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.9.1...v2.9.2)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Error on GJ admin UI search form [\#487](https://github.com/bensheldon/good_job/issues/487)
10
+ - Use `websearch_to_tsquery` or \(`plainto_tsquery` for Postgres \< v11\) for Dashboard search filter [\#488](https://github.com/bensheldon/good_job/pull/488) ([bensheldon](https://github.com/bensheldon))
11
+
12
+ **Merged pull requests:**
13
+
14
+ - Update README to illustrate using named arguments for the unique key. [\#486](https://github.com/bensheldon/good_job/pull/486) ([phallstrom](https://github.com/phallstrom))
15
+ - Add details about exactly where to require the engine. [\#485](https://github.com/bensheldon/good_job/pull/485) ([phallstrom](https://github.com/phallstrom))
16
+ - $ symbol gets copied when clicking on the copy button [\#484](https://github.com/bensheldon/good_job/pull/484) ([zeevy](https://github.com/zeevy))
17
+
3
18
  ## [v2.9.1](https://github.com/bensheldon/good_job/tree/v2.9.1) (2022-01-13)
4
19
 
5
20
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.9.0...v2.9.1)
6
21
 
22
+ **Fixed bugs:**
23
+
24
+ - Start async adapters once `ActiveRecord` and `ActiveJob` have loaded, potentially before `Rails.application.initialized?` [\#483](https://github.com/bensheldon/good_job/pull/483) ([bensheldon](https://github.com/bensheldon))
25
+
7
26
  **Closed issues:**
8
27
 
9
28
  - Graceful fallback to polling when LISTEN/NOTIFY isn't available [\#482](https://github.com/bensheldon/good_job/issues/482)
10
29
  - Long running locks on latest good job [\#480](https://github.com/bensheldon/good_job/issues/480)
11
30
 
12
- **Merged pull requests:**
13
-
14
- - Start async adapters once `ActiveRecord` and `ActiveJob` have loaded, potentially before `Rails.application.initialized?` [\#483](https://github.com/bensheldon/good_job/pull/483) ([bensheldon](https://github.com/bensheldon))
15
-
16
31
  ## [v2.9.0](https://github.com/bensheldon/good_job/tree/v2.9.0) (2022-01-09)
17
32
 
18
33
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v2.8.1...v2.9.0)
data/README.md CHANGED
@@ -73,19 +73,19 @@ For more of the story of GoodJob, read the [introductory blog post](https://isla
73
73
  1. Install the gem:
74
74
 
75
75
  ```bash
76
- $ bundle install
76
+ bundle install
77
77
  ```
78
78
 
79
79
  1. Run the GoodJob install generator. This will generate a database migration to create a table for GoodJob's job records:
80
80
 
81
81
  ```bash
82
- $ bin/rails g good_job:install
82
+ bin/rails g good_job:install
83
83
  ```
84
84
 
85
85
  Run the migration:
86
86
 
87
87
  ```bash
88
- $ bin/rails db:migrate
88
+ bin/rails db:migrate
89
89
  ```
90
90
 
91
91
  Optional: If using Rails' multiple databases with the `migrations_paths` configuration option, use the `--database` option:
@@ -328,7 +328,7 @@ _🚧 GoodJob's dashboard is a work in progress. Please contribute ideas and cod
328
328
 
329
329
  GoodJob includes a Dashboard as a mountable `Rails::Engine`.
330
330
 
331
- 1. Explicitly require the Engine code at the top of your `config/application.rb` file, immediately after Rails is required. This is necessary because the mountable engine is an optional feature of GoodJob.
331
+ 1. Explicitly require the Engine code at the top of your `config/application.rb` file, immediately after Rails is required and before Bundler requires the Rails' groups. This is necessary because the mountable engine is an optional feature of GoodJob.
332
332
 
333
333
  ```ruby
334
334
  # config/application.rb
@@ -339,6 +339,8 @@ GoodJob includes a Dashboard as a mountable `Rails::Engine`.
339
339
  # ...
340
340
  ```
341
341
 
342
+ Note: If you find the dashboard fails to reload due to a routing error and uninitialized constant `GoodJob::ExecutionsController`, this is likely because you are not requiring the engine early enough.
343
+
342
344
  1. Mount the engine in your `config/routes.rb` file. The following will mount it at `http://example.com/good_job`.
343
345
 
344
346
  ```ruby
@@ -399,6 +401,9 @@ class MyJob < ApplicationJob
399
401
  # Can be String or Lambda/Proc that is invoked in the context of the job.
400
402
  # Note: Arguments passed to #perform_later must be accessed through `arguments` method.
401
403
  key: -> { "Unique-#{arguments.first}" } # MyJob.perform_later("Alice") => "Unique-Alice"
404
+
405
+ # If the method uses named parameters, they can be accessed like so:
406
+ # key: -> { "Unique-#{arguments.first['name']}" } # MyJob.perform_later(name: "Alice")
402
407
  )
403
408
 
404
409
  def perform(first_name)
@@ -34,9 +34,18 @@ module GoodJob
34
34
  next if query.blank?
35
35
 
36
36
  tsvector = "(to_tsvector('english', serialized_params) || to_tsvector('english', id::text) || to_tsvector('english', COALESCE(error, '')::text))"
37
- where("#{tsvector} @@ to_tsquery(?)", query)
38
- .order(sanitize_sql_for_order([Arel.sql("ts_rank(#{tsvector}, to_tsquery(?))"), query]) => 'DESC')
37
+ to_tsquery_function = database_supports_websearch_to_tsquery? ? 'websearch_to_tsquery' : 'plainto_tsquery'
38
+ where("#{tsvector} @@ #{to_tsquery_function}(?)", query)
39
+ .order(sanitize_sql_for_order([Arel.sql("ts_rank(#{tsvector}, #{to_tsquery_function}(?))"), query]) => 'DESC')
39
40
  end)
40
41
  end
42
+
43
+ class_methods do
44
+ def database_supports_websearch_to_tsquery?
45
+ return @_database_supports_websearch_to_tsquery if defined?(@_database_supports_websearch_to_tsquery)
46
+
47
+ @_database_supports_websearch_to_tsquery = connection.postgresql_version >= 110000
48
+ end
49
+ end
41
50
  end
42
51
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '2.9.1'
4
+ VERSION = '2.9.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-13 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob