foobara-active-record-type 0.0.2 → 0.0.4
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 +6 -2
- data/lib/foobara/active_record_type.rb +2 -0
- data/src/active_record_foobara_methods.rb +6 -1
- data/src/extend_active_record_type_declaration/active_record_base_class_desugarizer.rb +4 -2
- data/src/extend_active_record_type_declaration/to_type_transformer.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1328ea690e597739be16596f51e9b71c289486409d87f6e005e4a84c47fc413b
|
4
|
+
data.tar.gz: f02618973852ed64a501b8ec4cde0872932c21a53aa3ae6678b27e71be4476b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f2901fa9461fcecd6adbf4bd8506e952d657d946d5e8b6a012a8df1e7ea9460b72416fd4e321e1e8108c21e383ed1c1d808077eebbc38d431a968bdd7ac17a3
|
7
|
+
data.tar.gz: 9d6b34ce44b69da4e20cb8245eb09886b7d5af88ecef493b236c081c7948250822b3e740ab09a790934d9ec86825bb6f65e5be58684264adbbf3fa3851c1c7e2
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
-
## [0.0.
|
1
|
+
## [0.0.4] - 2025-01-21
|
2
|
+
|
3
|
+
- Make use of ModelAttributeHelpers
|
4
|
+
|
5
|
+
## [0.0.3] - 2025-01-17
|
2
6
|
|
3
7
|
- Fix problem where the first time a type is declared via an
|
4
8
|
active record class it has a complex declaration hash instead of a simple
|
5
9
|
registered class lookup
|
6
10
|
|
7
|
-
## [0.0.1]
|
11
|
+
## [0.0.1] - 2025-01-03
|
8
12
|
|
9
13
|
- Release as a gem
|
10
14
|
|
@@ -2,7 +2,12 @@ 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
|
+
|
7
|
+
# TODO: implement this or figure out how to re-use the methods from Entity/Model
|
8
|
+
def foobara_associations
|
9
|
+
{}
|
10
|
+
end
|
6
11
|
end
|
7
12
|
end
|
8
13
|
|
@@ -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
|
-
|
14
|
-
|
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
|
-
|
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.
|
4
|
+
version: 0.0.4
|
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-21 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activerecord
|