foobara-active-record-type 0.0.2 → 0.0.3

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: 308b78e110004588dedfaec131948d47f060ed15fa8a09fa241af01d15bf83d7
4
- data.tar.gz: a17c4130c51c4d2cc6c51a48ee50b5b176bd98fd0237fe8cf26c225a9a2a971e
3
+ metadata.gz: 3499a493db193b496a20ae4dd0d1dd1d7ad5193701346ee2de9abc397b107ff9
4
+ data.tar.gz: 59db77d01419543a0230aecb0d5f49aa6f1ba541bb820d7ffd743ee41211d2ea
5
5
  SHA512:
6
- metadata.gz: d8fa16c2ba0deaf38e9d0f66d273b939be62d69bb8eb85590574d0eec1d472a966513154774d8fbaff8744767ceb45a398ec1faeb6c2ed2b497e6d8a4bdf0443
7
- data.tar.gz: 9e47b6836d783f38b90636d3713da58222a8c3668ebac313736b63cd08b40b25c304d73ffc4b8248608ac6215860083fb967244f7b5364b57f730945df841360
6
+ metadata.gz: a72802f7ae7ef65f5174285ae4dde77f7876b3463ea3d6a69bc7366a91838b5e1a22b94a8c6352b3725755195121855f391a30163378ceb065cfd16c6d9b9622
7
+ data.tar.gz: b49ed2b61b22d34e1b0179c841e2deb05ac5b0886fa71826bcb781f1572e6c52323ed729cd2ae7b058d5e078a184fb872e8dff4329fdd8184c557f7ef15332f0
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## [0.0.2]
1
+ ## [0.0.3]
2
2
 
3
3
  - Fix problem where the first time a type is declared via an
4
4
  active record class it has a complex declaration hash instead of a simple
@@ -2,7 +2,7 @@ module ActiveRecordFoobaraMethods
2
2
  extend ActiveSupport::Concern
3
3
 
4
4
  class_methods do
5
- attr_accessor :foobara_type
5
+ attr_accessor :foobara_type, :foobara_attributes_type
6
6
  end
7
7
  end
8
8
 
@@ -10,8 +10,10 @@ module Foobara
10
10
  active_record_superclass = active_record_class.superclass
11
11
 
12
12
  if active_record_superclass != ActiveRecord::Base
13
- # this will register a foobara type for the base class
14
- type_for_declaration(active_record_class.superclass)
13
+ if active_record_superclass.attribute_names.include?(active_record_class.primary_key)
14
+ # this will register a foobara type for the base class
15
+ type_for_declaration(active_record_class.superclass)
16
+ end
15
17
  end
16
18
 
17
19
  {
@@ -13,7 +13,9 @@ module Foobara
13
13
  handler = handler_for_class(TypeDeclarations::Handlers::ExtendAttributesTypeDeclaration)
14
14
  attributes_type_declaration = type.declaration_data[:attributes_declaration]
15
15
 
16
- type.element_types = handler.process_value!(attributes_type_declaration).element_types
16
+ active_record_class.foobara_attributes_type = handler.process_value!(attributes_type_declaration)
17
+
18
+ type.element_types = active_record_class.foobara_attributes_type.element_types
17
19
  type_name = type.declaration_data[:name]
18
20
 
19
21
  # We don't want to check that the active record is valid as if it were a model
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-active-record-type
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-17 00:00:00.000000000 Z
10
+ date: 2025-01-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activerecord