frozen_record 0.25.4 → 0.25.5

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: 45e9d1a344670234462c22c5d74da8b8e1bf4b726b14b447d1abe646632aae26
4
- data.tar.gz: 96c4daa09b3b7b46f332e082ff94f91683d5da82b378bf32398bcbc88f4c4c7c
3
+ metadata.gz: b8fc155c1a350f49fbc79e245cc768722c9880cd0010b7829a33aea0ac55ab69
4
+ data.tar.gz: a16dde142d53022fb3b76b8262326d774342f4158b7d1ec018bf0a4879d41d77
5
5
  SHA512:
6
- metadata.gz: a78872e27a9341f152867b4ee1d281c4512cff485e8c07fd343abab52fd71bb461e0c98c221460e3bce95bf63b7eaff49dd66d1c9166ca4f357eccd65531dcf8
7
- data.tar.gz: 3b05ceacab2a957f44818338b2b71555d65baa66dd6cf1e5ee55b21cc0e6c8eb307d4c3ea8af9e7d00bc09ea0d3ce0712e8598225e9f952c0422cb2ddad1694c
6
+ metadata.gz: 4a315f98d4d6c79dc0ac6146715fdee499d383fc9d5e550bbdc7278655a19da2b744923ed41f7f445fc4175f575f6ea1330e77381edfe77fa5dbd4152e6446bb
7
+ data.tar.gz: d9e7d61a94c6504ecb0c3fc4e298487bfa30a5d9fd7b527657fc51259246aa23030567f676d2ff06595dca1b1de7a78281bb2380b19ae23145ccd04397dd0799
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
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
+
3
7
  # v0.25.4
4
8
 
5
9
  - Minor Ruby 3.2 compatiblity fix (regarding `ruby2_keywords`).
@@ -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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FrozenRecord
4
- VERSION = '0.25.4'
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.4
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