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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/foobara/active_record_type.rb +2 -0
- data/src/active_record_foobara_methods.rb +13 -1
- data/src/extend_active_record_type_declaration/active_record_base_class_desugarizer.rb +5 -1
- data/src/extend_active_record_type_declaration/to_type_transformer.rb +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f7d5092a44023063818776cd29a0cacb950adc6a4299959b8de173e8a2bd8af
|
4
|
+
data.tar.gz: e44239f4fecaf4a20abe8d642c53100f32d9a420441fbd30642278f3a5b84c05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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.
|
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-
|
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.
|
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: []
|