active_fields 2.0.0 → 2.0.1

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: 1d32fccb9d7af7eab0db169ea67d7046e09d6f8eace84e0a2c49f32574377543
4
- data.tar.gz: 0fa74f41f48702355d9fc73f64d49389433f03e94b62e5d3e2552fcff01ec7f3
3
+ metadata.gz: 6c94bb84092249c9db341f69ec79233da8440b8ef74c00475c5c8acb6e42a290
4
+ data.tar.gz: 7653a7859137a53d465ccc2398f055f064105949f0a3be7e1e7fc5f3636ee240
5
5
  SHA512:
6
- metadata.gz: 6e76f8e6e24e1b65a8d16480b06ce348c0d777dae4be55ec4fd908d82b17752d69866d9e73cee2847dafa1b04800977d34048eac8f0e7efc61644ddc2f30ae07
7
- data.tar.gz: 673b3a37fcd8f2a1e0ee0d40bb3f80192d2a24933e097aae4d76d1a34d9fb04850a2b5504d2301b70cdbf2226a43bd96fd0bda0e58314aaf6ff3f54d2b7e0237
6
+ metadata.gz: 57eecfc4cb3cf040dfcc2daf59a804b33ea5b3f9744cde6931c8fa0f9777eeeb067d3895b33ebbf927c5b74c66290f00546986d472d038c11df700d8092631d7
7
+ data.tar.gz: 1e923ede58bd193079334b3fcb9e193fdd61b56d6d73ffdf977a626618d2e308787641c8194ebc806113141b9dd66a3e5fbea106c0d0ded699c866a10a6b8d0b
data/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
1
  ## [Unreleased]
2
+
3
+ # [2.0.1] - 2025-04-09
4
+ - Fixed search with `nil` operator
5
+
6
+ ## [2.0.0] - 2025-02-22
2
7
  - Drop support for _Rails_ < 7.1
3
8
  - Drop support for _Ruby_ < 3.1 (EOL)
4
9
  - Added search functionality
@@ -6,14 +6,12 @@ module ActiveFields
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
- # rubocop:disable Rails/ReflectionClassName
10
9
  has_many :active_values,
11
10
  class_name: ActiveFields.config.value_class_name,
12
11
  as: :customizable,
13
12
  inverse_of: :customizable,
14
13
  autosave: true,
15
14
  dependent: :destroy
16
- # rubocop:enable Rails/ReflectionClassName
17
15
 
18
16
  # Searches customizables by active_values.
19
17
  #
@@ -6,13 +6,11 @@ module ActiveFields
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
- # rubocop:disable Rails/ReflectionClassName
10
9
  has_many :active_values,
11
10
  class_name: ActiveFields.config.value_class_name,
12
11
  foreign_key: :active_field_id,
13
12
  inverse_of: :active_field,
14
13
  dependent: :destroy
15
- # rubocop:enable Rails/ReflectionClassName
16
14
 
17
15
  scope :for, ->(customizable_type) { where(customizable_type: customizable_type) }
18
16
 
@@ -7,12 +7,10 @@ module ActiveFields
7
7
 
8
8
  included do
9
9
  belongs_to :customizable, polymorphic: true, optional: false, inverse_of: :active_values
10
- # rubocop:disable Rails/ReflectionClassName
11
10
  belongs_to :active_field,
12
11
  class_name: ActiveFields.config.field_base_class_name,
13
12
  optional: false,
14
13
  inverse_of: :active_values
15
- # rubocop:enable Rails/ReflectionClassName
16
14
 
17
15
  validates :active_field, uniqueness: { scope: :customizable }
18
16
  validate :validate_value
@@ -52,7 +52,7 @@ module ActiveFields
52
52
  # @param op [String, Symbol] Operation name or operator
53
53
  # @param value [Any] The value to search for
54
54
  def search(op:, value:)
55
- op = op.to_sym
55
+ op = op.to_sym if op.respond_to?(:to_sym)
56
56
  operation = self.class.__operations__.key?(op) ? op : self.class.__operators__[op]
57
57
  return if operation.nil?
58
58
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveFields
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Usanov
8
8
  - LassoID
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-22 00:00:00.000000000 Z
11
+ date: 2025-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails