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 +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/foobara/active_record_type.rb +2 -1
- data/src/active_record_foobara_methods.rb +40 -18
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c68604cfe7a45eebcd95e02929f5756dbc0c703547f6deb9c0a7adb940cb938e
|
4
|
+
data.tar.gz: 507df2c192c22ce5f58514314569cfe1314c24a35a0ded7ca62f020d6a3def3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd16b65c7084969996655dd9bd24ed93c2481c80f1c17465d0b97f7b920cd6f30b007fe07c316037d1c91ad77921d4482c89b44988822767ed77e8056eb1601a
|
7
|
+
data.tar.gz: 3f9963f87e6708158528ce25cd38544c37c7274c4d6b80e866afba080748e2794859b51097d871702a0ef13d88a8c8faf2796f6fcaca1896f18dd0e4bc035993
|
data/CHANGELOG.md
CHANGED
@@ -19,7 +19,8 @@ module Foobara
|
|
19
19
|
|
20
20
|
BuiltinTypes.install_type_declaration_extensions_for(ExtendActiveRecordTypeDeclaration)
|
21
21
|
|
22
|
-
ActiveRecord::Base.include
|
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
|
2
|
-
|
1
|
+
module Foobara
|
2
|
+
module ActiveRecordType
|
3
|
+
module ActiveRecordFoobaraMethods
|
4
|
+
extend ActiveSupport::Concern
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
class_methods do
|
7
|
+
attr_accessor :foobara_type, :foobara_attributes_type
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
17
|
-
|
26
|
+
def foobara_attributes_for_create(...)
|
27
|
+
TypeDeclarations::Attributes.reject(super, :created_at, :updated_at)
|
28
|
+
end
|
18
29
|
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|