foobara-active-record-type 0.0.9 → 0.0.11

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: ef9d7117540d6792f07286b6d6c73ef07124f69cfdb33cd2456614c2d7712ead
4
- data.tar.gz: 8d3479a3abd3fe8aa0e52dbaaf27b17d99c6e41e85c9edf5948097e2d3494a9c
3
+ metadata.gz: 0f7d5092a44023063818776cd29a0cacb950adc6a4299959b8de173e8a2bd8af
4
+ data.tar.gz: e44239f4fecaf4a20abe8d642c53100f32d9a420441fbd30642278f3a5b84c05
5
5
  SHA512:
6
- metadata.gz: 2121dcd3d9c61a860347e487631e2e9b5420bcd691f5f97d86d7ef2bd9e93320af60dc66d0c1b878e75ccfac2a819d2fe826d3f17e8b721ba5876a344d2eb7e6
7
- data.tar.gz: fc18a7d564dd316258f0e87317575781a197e31e5cdbf0a725a6dcce622192f573c3b388d995fea0c064ba09dfca90f57e5088a073cf248a37de23c2c02d5012
6
+ metadata.gz: ff9efed87c28bfbe8a559827066d98260994e55bb8566795c84190b60f09420fd5444d070b8dd4c4bdb14b2e8ae7aa1ade09a0f3b1696dc1694ac8085a42ef49
7
+ data.tar.gz: 6a91b088e7fe7f6f91a32914ed74fdcbf671431fa722de22cfb8cbd70ae69aec04b70be8194a952be270963fc0f72e23bcb3aa8a1bb6feb5f5c46c298c048e6c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [0.0.11] - 2025-01-30
2
+
3
+ - Add some missing methods to ActiveRecord::Base
4
+ - Fix bug where primary key is a string instead of a symbol
5
+
6
+ ## [0.0.10] - 2025-01-29
7
+
8
+ - Fix bug causing duplication of domain name in type name
9
+
1
10
  ## [0.0.9] - 2025-01-28
2
11
 
3
12
  - Fix problem with attributes declaration validator breaking things
@@ -22,6 +22,8 @@ module Foobara
22
22
 
23
23
  ActiveRecord::Base.include ModelAttributeHelpers::Concerns::AttributeHelpers
24
24
  ActiveRecord::Base.include ActiveRecordFoobaraMethods
25
+ ActiveRecord::Base.include Foobara::DetachedEntity::Concerns::Reflection
26
+ ActiveRecord::Base.include Foobara::Model::Concerns::Reflection
25
27
 
26
28
  if defined?(Foobara::CommandConnectors::RailsCommandConnector)
27
29
  Foobara::CommandConnectors::RailsCommandConnector.default_serializers = [
@@ -11,8 +11,20 @@ module Foobara
11
11
  {}
12
12
  end
13
13
 
14
+ # TODO: implement this or figure out how to re-use the methods from Entity/Model
15
+ def foobara_deep_associations
16
+ # TODO: test this
17
+ # :nocov:
18
+ {}
19
+ # :nocov:
20
+ end
21
+
22
+ def foobara_model_name
23
+ foobara_type&.scoped_name || Util.non_full_name(self)
24
+ end
25
+
14
26
  def foobara_primary_key_attribute
15
- primary_key
27
+ primary_key&.to_sym
16
28
  end
17
29
 
18
30
  def foobara_primary_key_type
@@ -16,10 +16,14 @@ module Foobara
16
16
  end
17
17
  end
18
18
 
19
+ domain = Foobara::Domain.domain_through_modules(active_record_class)
20
+
21
+ name = active_record_class.name.gsub(/^#{domain.scoped_full_name}::/, "")
22
+
19
23
  {
20
24
  type: :active_record,
21
25
  model_class: active_record_class.name,
22
- name: active_record_class.name,
26
+ name:,
23
27
  model_base_class: active_record_superclass.name,
24
28
  model_module: Util.module_for(active_record_class)&.name,
25
29
  primary_key: active_record_class.primary_key,
@@ -19,6 +19,9 @@ module Foobara
19
19
  type_name = type.declaration_data[:name]
20
20
 
21
21
  domain = Domain.domain_through_modules(active_record_class)
22
+
23
+ type_name = type_name.gsub(/^#{domain.scoped_full_name}::/, "")
24
+
22
25
  domain.foobara_register_type(type_name, type)
23
26
  end
24
27
  end
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.9
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-28 00:00:00.000000000 Z
10
+ date: 2025-01-30 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activerecord
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0'
92
92
  requirements: []
93
- rubygems_version: 3.6.2
93
+ rubygems_version: 3.6.3
94
94
  specification_version: 4
95
95
  summary: Provides a detached entity foobara type for Active Record classes
96
96
  test_files: []