active_record_compose 1.0.0 → 1.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: 9cdfb23b1af43681e6c4af3e9fed615bc3dc64873461bdee6f49c92f706f33e9
4
- data.tar.gz: 4530c0987f038605cb6dc3da229df21e8cf16af29d6ca8cf3078b1dc933cc838
3
+ metadata.gz: a8fa5fa4117b180d20233c6dc06ca8797c2c9931cca2708e5a01bd2b560c42d2
4
+ data.tar.gz: cdb73d45e04a3195f9834390f9e9b6e8242e4a9b325a6ec684d3c7c2f97076ef
5
5
  SHA512:
6
- metadata.gz: 10c37b41ff66acd993e2f5c412ed5f48213f29344a94e0ab27d40766e11f60197808d4d1b9e97118f729b4be1d272a4bdae100c8e06489c40008ac3c92f6fe61
7
- data.tar.gz: 67c4086fce4661e89188161fd6d23610bca3dcb9ad8a6e781162909d07fbf750add3ad804d8e58bd92bf4fc1305bcebd2452a4a9d924af70e56e6a0217ecf70f
6
+ metadata.gz: 2317d9e39b054c728b0847c6cde3f556edfcfa57de9b1c6023f10cf264f5c498bcf654e252d7a29c0a071d349ade5f00943e512938a427b6d253bd43592ebace
7
+ data.tar.gz: 71ad4690a7af527a1d323e3ccc84b25c0b7f875fcc3655883d0b8c2e35fe165b3b1f17a6201152e6d0281b21716976c77eec26db6c5712c0630d2741e6b72886
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.0.1] - 2025-10-17
4
+
5
+ * Removed the private interface `composite_primary_key?`
6
+ This was previously an internal ActiveRecord dependency, but was not exposed in the release version.
7
+ (https://github.com/hamajyotan/active_record_compose/pull/39)
8
+ * Relaxed ActiveRecord dependency upper bound to < 8.2
9
+ (https://github.com/hamajyotan/active_record_compose/pull/42)
10
+
3
11
  ## [1.0.0] - 2025-09-23
4
12
 
5
13
  - drop support rails 7.0.x
data/README.md CHANGED
@@ -120,6 +120,12 @@ registration.update!(
120
120
  email_confirmation: "bar@example.com",
121
121
  terms_of_service: true,
122
122
  )
123
+ # `#update!` SQL log
124
+ # BEGIN immediate TRANSACTION
125
+ # INSERT INTO "accounts" ("created_at", "email", "name", "updated_at") VALUES (...
126
+ # INSERT INTO "profiles" ("account_id", "age", "created_at", "firstname", "lastname", ...
127
+ # COMMIT TRANSACTION
128
+
123
129
 
124
130
  # === Or, in a Rails controller with strong parameters ===
125
131
  class UserRegistrationsController < ApplicationController
@@ -359,6 +359,29 @@ module ActiveRecordCompose
359
359
  super
360
360
  end
361
361
 
362
+ # Returns the ID value. This value is used when passing it to the `:model` option of `form_with`, etc.
363
+ # Normally it returns nil, but it can be overridden to delegate to the containing model.
364
+ #
365
+ # @example Redefine the id method by delegating to the containing model
366
+ # class Foo < ActiveRecordCompose::Model
367
+ # def initialize(primary_model)
368
+ # @primary_model = primary_model
369
+ # # ...
370
+ # end
371
+ #
372
+ # def id
373
+ # primary_model.id
374
+ # end
375
+ #
376
+ # private
377
+ #
378
+ # attr_reader :primary_model
379
+ # end
380
+ #
381
+ # @return [Object] ID value
382
+ #
383
+ def id = nil
384
+
362
385
  private
363
386
 
364
387
  # Returns a collection of model elements to encapsulate.
@@ -20,15 +20,11 @@ module ActiveRecordCompose
20
20
  # In ActiveRecord, it is soft deprecated.
21
21
  delegate :connection, to: :ar_class
22
22
 
23
- def composite_primary_key? = false # steep:ignore
24
-
25
23
  private
26
24
 
27
25
  def ar_class = ActiveRecord::Base
28
26
  end
29
27
 
30
- def id = nil
31
-
32
28
  def trigger_transactional_callbacks? = true
33
29
  def restore_transaction_record_state(_force_restore_state = false) = nil
34
30
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordCompose
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
@@ -101,8 +101,6 @@ module ActiveRecordCompose
101
101
  extend ActiveSupport::Concern
102
102
  include ActiveRecord::Transactions
103
103
 
104
- def id: -> untyped
105
-
106
104
  module ClassMethods
107
105
  def connection: -> ActiveRecord::ConnectionAdapters::AbstractAdapter
108
106
  def lease_connection: -> ActiveRecord::ConnectionAdapters::AbstractAdapter
@@ -82,6 +82,8 @@ module ActiveRecordCompose
82
82
  def update: (Hash[attribute_name, untyped]) -> bool
83
83
  def update!: (Hash[attribute_name, untyped]) -> untyped
84
84
 
85
+ def id: -> untyped
86
+
85
87
  private
86
88
  def models: -> ComposedCollection
87
89
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hamajyotan
@@ -18,7 +18,7 @@ dependencies:
18
18
  version: '7.1'
19
19
  - - "<"
20
20
  - !ruby/object:Gem::Version
21
- version: '8.1'
21
+ version: '8.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,7 +28,7 @@ dependencies:
28
28
  version: '7.1'
29
29
  - - "<"
30
30
  - !ruby/object:Gem::Version
31
- version: '8.1'
31
+ version: '8.2'
32
32
  description: activemodel form object pattern. it embraces multiple AR models and provides
33
33
  a transparent interface as if they were a single model.
34
34
  email: