frozen_record 0.25.2 → 0.25.5

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: e254d236ad017c1f92834767dfb9f8daa686965ff6d3328543e6707be703280e
4
- data.tar.gz: ea51bf7bdbae4103e9cb43bbe204e276efb9dea1e4cc6f36e11edac9977a6175
3
+ metadata.gz: b8fc155c1a350f49fbc79e245cc768722c9880cd0010b7829a33aea0ac55ab69
4
+ data.tar.gz: a16dde142d53022fb3b76b8262326d774342f4158b7d1ec018bf0a4879d41d77
5
5
  SHA512:
6
- metadata.gz: ca56d88a30cd1636ddeaed686c056a0352d295f3f0441c2b0a4861b5dcac7786497f140dbc351d0d332e862a03173ca5ace48fe880c1e1c934216034bfaa211a
7
- data.tar.gz: 7522b566accc6d996eb79bb574f977ff82913e6d678b153cb7f0b58fd36dc0db7572611c769ac416c354673900412362f71da85573f3ea2cbc97675e1bbae1cb
6
+ metadata.gz: 4a315f98d4d6c79dc0ac6146715fdee499d383fc9d5e550bbdc7278655a19da2b744923ed41f7f445fc4175f575f6ea1330e77381edfe77fa5dbd4152e6446bb
7
+ data.tar.gz: d9e7d61a94c6504ecb0c3fc4e298487bfa30a5d9fd7b527657fc51259246aa23030567f676d2ff06595dca1b1de7a78281bb2380b19ae23145ccd04397dd0799
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Unreleased
2
2
 
3
+ # v0.25.5
4
+
5
+ - `FrozenRecord::Base#==` now returns `false` if the primary key is `nil` (to match the `ActiveRecord::Base` implementation)
6
+
7
+ # v0.25.4
8
+
9
+ - Minor Ruby 3.2 compatiblity fix (regarding `ruby2_keywords`).
10
+
11
+ # v0.25.3
12
+
13
+ - Also disable max_records_scan when loading `Compact` records.
14
+
3
15
  # v0.25.2
4
16
 
5
17
  - Fix FrozenRecord.ignore_max_records_scan not applying
@@ -252,7 +252,7 @@ module FrozenRecord
252
252
  alias_method :attribute, :[]
253
253
 
254
254
  def ==(other)
255
- super || other.is_a?(self.class) && other.id == id
255
+ super || other.is_a?(self.class) && !id.nil? && other.id == id
256
256
  end
257
257
 
258
258
  def persisted?
@@ -19,7 +19,7 @@ module FrozenRecord
19
19
  @attributes = list_attributes(records).freeze
20
20
  build_attributes_cache
21
21
  define_attribute_methods(@attributes.to_a)
22
- records = records.map { |r| load(r) }.freeze
22
+ records = FrozenRecord.ignore_max_records_scan { records.map { |r| load(r) }.freeze }
23
23
  index_definitions.values.each { |index| index.build(records) }
24
24
  records
25
25
  end
@@ -242,17 +242,13 @@ module FrozenRecord
242
242
  if array_delegable?(method_name)
243
243
  to_a.public_send(method_name, *args, &block)
244
244
  elsif @klass.respond_to?(method_name)
245
- delegate_to_class(method_name, *args, &block)
245
+ scoping { @klass.public_send(method_name, *args, &block) }
246
246
  else
247
247
  super
248
248
  end
249
249
  end
250
250
  ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true)
251
251
 
252
- def delegate_to_class(*args, &block)
253
- scoping { @klass.public_send(*args, &block) }
254
- end
255
-
256
252
  def array_delegable?(method)
257
253
  Array.method_defined?(method) && !DISALLOWED_ARRAY_METHODS.include?(method)
258
254
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FrozenRecord
4
- VERSION = '0.25.2'
4
+ VERSION = '0.25.5'
5
5
  end
@@ -149,6 +149,13 @@ RSpec.shared_examples 'main' do
149
149
  expect(country).to be == second_country
150
150
  end
151
151
 
152
+ it 'returns false if both instances are from the same class and their ids are nil' do
153
+ country = country_model.new(id: nil)
154
+ second_country = country_model.new(id: nil)
155
+
156
+ expect(country).to_not be == second_country
157
+ end
158
+
152
159
  it 'returns false if both instances are not from the same class' do
153
160
  country = country_model.first
154
161
  car = car_model.new(id: country.id)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frozen_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.2
4
+ version: 0.25.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean Boussier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-13 00:00:00.000000000 Z
11
+ date: 2022-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  requirements: []
140
- rubygems_version: 3.3.7
140
+ rubygems_version: 3.1.2
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: ActiveRecord like interface to read only access and query static YAML files