yiffspace 0.1.1 → 0.1.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c3be80e2fa924d259e3a4502497bbea827cb29c6c16ecb265598654cb6ab677b
|
|
4
|
+
data.tar.gz: 12cb0154940d5298ebf93283a58f90ee5144c3aaefe5f7911f9ca99ccde51d33
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82a169afe55e2d6ee9305834aedc1c5ddd05ebb7d181cfcb560853dc12564e21aa163d96b2db95c81878078565902a0ea3432acaea6bf413894ccf3328c99f2b
|
|
7
|
+
data.tar.gz: ed6f7e67a45373d406fa1beb219e661aa9223b62bd5efce93d20df69dd8641f760eddb8fdb7f6a53dcc986ea3a0423b5b3d0d569318e97cd0c82fb4ad7357584
|
|
@@ -26,7 +26,7 @@ module YiffSpace
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def statement_timeout
|
|
29
|
-
|
|
29
|
+
YiffSpace.config.application_record_class.connection.select_one("SELECT setting FROM pg_settings WHERE name = 'statement_timeout'")["setting"].to_i
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# CrossJoinLateral, LeftJoinLateral, nil
|
|
@@ -42,6 +42,14 @@ module YiffSpace
|
|
|
42
42
|
# Default: -> { (user_class || ::User).system }
|
|
43
43
|
attr_writer(:system_user_getter)
|
|
44
44
|
|
|
45
|
+
# The application's ApplicationRecord class. Used by Concerns::ActiveRecordExtensions & Utils::TableBuilder.
|
|
46
|
+
# Falls back to ::ApplicationRecord at call time when nil.
|
|
47
|
+
attr_writer(:application_record_class)
|
|
48
|
+
|
|
49
|
+
# The application's ApplicationController class. Used by Utils::Helpers & Utils::TableBuilder.
|
|
50
|
+
# Falls back to ::ApplicationController at call time when nil.
|
|
51
|
+
attr_writer(:application_controller_class)
|
|
52
|
+
|
|
45
53
|
def initialize
|
|
46
54
|
@max_multi_count = -> { 100 }
|
|
47
55
|
@redis_url = -> {}
|
|
@@ -93,6 +101,14 @@ module YiffSpace
|
|
|
93
101
|
@anonymous_user_name = value.is_a?(Proc) ? value : -> { value }
|
|
94
102
|
end
|
|
95
103
|
|
|
104
|
+
def application_record_class
|
|
105
|
+
@application_record_class || ::ApplicationRecord
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def application_controller_class
|
|
109
|
+
@application_controller_class || ::ApplicationController
|
|
110
|
+
end
|
|
111
|
+
|
|
96
112
|
def images
|
|
97
113
|
@images ||= Images.new
|
|
98
114
|
end
|
|
@@ -6,14 +6,14 @@ module YiffSpace
|
|
|
6
6
|
module_function
|
|
7
7
|
|
|
8
8
|
def method_missing(name, *, &)
|
|
9
|
-
helpers =
|
|
9
|
+
helpers = YiffSpace.config.application_controller_class.helpers
|
|
10
10
|
return helpers.public_send(name, *, &) if helpers.respond_to?(name)
|
|
11
11
|
|
|
12
12
|
super
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def respond_to_missing?(name, include_private = false)
|
|
16
|
-
|
|
16
|
+
YiffSpace.config.application_controller_class.helpers.respond_to?(name, include_private) || super
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -123,12 +123,12 @@ module YiffSpace
|
|
|
123
123
|
# @param _row [Integer] the row number (unused)
|
|
124
124
|
# @return [Hash] the <tr> attributes
|
|
125
125
|
def all_row_attributes(item, _row)
|
|
126
|
-
return {} unless item.is_a?(
|
|
126
|
+
return {} unless item.is_a?(YiffSpace.config.application_record_class)
|
|
127
127
|
|
|
128
128
|
{
|
|
129
129
|
id: "#{item.model_name.singular.dasherize}-#{item.id}",
|
|
130
130
|
**row_attributes,
|
|
131
|
-
**
|
|
131
|
+
**YiffSpace.config.application_controller_class.helpers.data_attributes_for(item),
|
|
132
132
|
}
|
|
133
133
|
end
|
|
134
134
|
end
|
data/lib/yiffspace/version.rb
CHANGED