foobara-active-record-type 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be73fbca7fffeee0f67d261c388d9389c98220d6db6748a3ba349e67d210567c
4
- data.tar.gz: af657447cb5eddd2722cd3b30940e721d91d4357c64ed6e78485cf9934567705
3
+ metadata.gz: c68604cfe7a45eebcd95e02929f5756dbc0c703547f6deb9c0a7adb940cb938e
4
+ data.tar.gz: 507df2c192c22ce5f58514314569cfe1314c24a35a0ded7ca62f020d6a3def3a
5
5
  SHA512:
6
- metadata.gz: 3a9a10892d969e0a6eb51dc5a34e57bb056f3ec16a1499fa16545b1bcfd5cebb9d4f140d66921d85107e1c7d83742c5890fd9d4373ad2a094d71cb235e309171
7
- data.tar.gz: 06ec78753cf3bfff0e476b8b276f2f4d6e933a8fa4a6b0c62161a2a4e26470eb838f4528b44fccd7ecdb8c03917385d34b7c777171bc767ec142cc2c3613025f
6
+ metadata.gz: cd16b65c7084969996655dd9bd24ed93c2481c80f1c17465d0b97f7b920cd6f30b007fe07c316037d1c91ad77921d4482c89b44988822767ed77e8056eb1601a
7
+ data.tar.gz: 3f9963f87e6708158528ce25cd38544c37c7274c4d6b80e866afba080748e2794859b51097d871702a0ef13d88a8c8faf2796f6fcaca1896f18dd0e4bc035993
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ## [0.0.5] - 2025-01-21
1
+ ## [0.0.6] - 2025-01-22
2
2
 
3
3
  - Make use of ModelAttributeHelpers
4
4
 
@@ -19,7 +19,8 @@ module Foobara
19
19
 
20
20
  BuiltinTypes.install_type_declaration_extensions_for(ExtendActiveRecordTypeDeclaration)
21
21
 
22
- ActiveRecord::Base.include Foobara::ModelAttributeHelpers::Concerns::AttributeHelpers
22
+ ActiveRecord::Base.include ModelAttributeHelpers::Concerns::AttributeHelpers
23
+ ActiveRecord::Base.include ActiveRecordFoobaraMethods
23
24
  end
24
25
 
25
26
  def reset_all
@@ -1,26 +1,48 @@
1
- module ActiveRecordFoobaraMethods
2
- extend ActiveSupport::Concern
1
+ module Foobara
2
+ module ActiveRecordType
3
+ module ActiveRecordFoobaraMethods
4
+ extend ActiveSupport::Concern
3
5
 
4
- class_methods do
5
- attr_accessor :foobara_type, :foobara_attributes_type
6
+ class_methods do
7
+ attr_accessor :foobara_type, :foobara_attributes_type
6
8
 
7
- # TODO: implement this or figure out how to re-use the methods from Entity/Model
8
- def foobara_associations
9
- {}
10
- end
9
+ # TODO: implement this or figure out how to re-use the methods from Entity/Model
10
+ def foobara_associations
11
+ {}
12
+ end
11
13
 
12
- def foobara_primary_key_attribute
13
- primary_key
14
- end
14
+ def foobara_primary_key_attribute
15
+ primary_key
16
+ end
17
+
18
+ def foobara_primary_key_type
19
+ return @foobara_primary_key_type if @foobara_primary_key_type
20
+
21
+ domain = foobara_type.foobara_domain
22
+ declaration = Foobara::ActiveRecordType.column_name_to_foobara_type_declaration(self, primary_key)
23
+ @foobara_primary_key_type = domain.foobara_type_from_declaration(declaration)
24
+ end
15
25
 
16
- def foobara_primary_key_type
17
- return @foobara_primary_key_type if @foobara_primary_key_type
26
+ def foobara_attributes_for_create(...)
27
+ TypeDeclarations::Attributes.reject(super, :created_at, :updated_at)
28
+ end
18
29
 
19
- domain = foobara_type.foobara_domain
20
- declaration = Foobara::ActiveRecordType.column_name_to_foobara_type_declaration(self, primary_key)
21
- @foobara_primary_key_type = domain.foobara_type_from_declaration(declaration)
30
+ def foobara_attributes_for_update(...)
31
+ TypeDeclarations::Attributes.reject(super, :created_at, :updated_at)
32
+ end
33
+
34
+ def foobara_attributes_for_aggregate_update(...)
35
+ TypeDeclarations::Attributes.reject(super, :created_at, :updated_at)
36
+ end
37
+
38
+ def foobara_attributes_for_atom_update(...)
39
+ TypeDeclarations::Attributes.reject(super, :created_at, :updated_at)
40
+ end
41
+
42
+ def foobara_attributes_for_find_by(...)
43
+ TypeDeclarations::Attributes.reject(super, :created_at, :updated_at)
44
+ end
45
+ end
22
46
  end
23
47
  end
24
48
  end
25
-
26
- ActiveRecord::Base.include ActiveRecordFoobaraMethods
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-active-record-type
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi