trophonius 1.2.4.9 → 1.2.4.10
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/lib/trophonius_model.rb +34 -0
- 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: c79101c445307adbbb319a9cf07fed8e2b0fb3ae6d17a213833452ff9252f6cd
|
|
4
|
+
data.tar.gz: 21e0bc3a18a443f3576699100c48cf4f1db6b9efe4a031d5c52a26c95a4cb464
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cfef37d5c0ddca6ac545d76ed5b62df8b8f1514f247cdf6749ab0925ac33a0d889fe6f11ba9a75985164c81e7b8ffb91c24c13df79ba53e4475aa53f3e27ec37
|
|
7
|
+
data.tar.gz: 6afb02d5bc0d8d8a33853ffc1eff5f1f7cceb4026a665e74f6ff01d3b7189a616e9cc127b8e9962ea8fa23abb381661d5c8dbb4602588668abf8168d2784be7d
|
data/lib/trophonius_model.rb
CHANGED
|
@@ -32,6 +32,40 @@ module Trophonius
|
|
|
32
32
|
@limit = ''
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
##
|
|
36
|
+
# Sets up the configuration for the model.
|
|
37
|
+
#
|
|
38
|
+
# @param [Hash] configuration: the hash containing the config to setup the model correctly.
|
|
39
|
+
# configuration = {layout_name: "theFileMakerLayoutForThisModel", non_modifiable_fields: ["an", "array", "containing", "calculation_fields", "etc."]}
|
|
40
|
+
def self.config(configuration)
|
|
41
|
+
@configuration ||= Configuration.new
|
|
42
|
+
@configuration.layout_name = configuration[:layout_name]
|
|
43
|
+
@configuration.non_modifiable_fields = configuration[:non_modifiable_fields]
|
|
44
|
+
@configuration.all_fields = {}
|
|
45
|
+
@configuration.translations = {}
|
|
46
|
+
@offset = ''
|
|
47
|
+
@limit = ''
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
##
|
|
51
|
+
# Add a has many relationship.
|
|
52
|
+
#
|
|
53
|
+
# @param [Symbol] model_name: the name of the model to build a relation with
|
|
54
|
+
# @param [String] primary_key: the name of the field containing the primary to build the relation over
|
|
55
|
+
# @param [String] foreign_key: the name of the field containing the primary to build the relation over
|
|
56
|
+
#
|
|
57
|
+
# @return [Trophonius::Model] Self
|
|
58
|
+
def self.has_many(model_name, primary_key:, foreign_key:)
|
|
59
|
+
@configuration ||= Configuration.new
|
|
60
|
+
@configuration.layout_name = configuration[:layout_name]
|
|
61
|
+
@configuration.non_modifiable_fields = configuration[:non_modifiable_fields]
|
|
62
|
+
@configuration.all_fields = {}
|
|
63
|
+
@configuration.translations = {}
|
|
64
|
+
@offset = ''
|
|
65
|
+
@limit = ''
|
|
66
|
+
self
|
|
67
|
+
end
|
|
68
|
+
|
|
35
69
|
##
|
|
36
70
|
# Limits the found record set.
|
|
37
71
|
#
|