motor-admin 0.2.75 → 0.2.76
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/motor/queries/run_query.rb +6 -2
- data/lib/motor/resources/fetch_configured_model.rb +2 -1
- data/lib/motor/version.rb +1 -1
- 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: 18e2c93dd34d0ae77436e9df549dcbe2ef0d3a2db500189a8ee62006937be637
|
4
|
+
data.tar.gz: 4bc2541c6982b92a852de17952a1002113bdf54daa8cdfc2cc517ff24e3986df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cef668b01fcd5a5dcb3aaa5cb801f8723d7b4ce9a9641550d1da8ac8643d6dbd1ea76ac41c8652cbe35a50b3f074d354a80b71770188383057471033aff06f14
|
7
|
+
data.tar.gz: e5bdbb4a1f4134fd13e60b30c913f5ef2290295007b73ba74238bcebc52206033b5262d96b15271e6cf39cde04aacf36c752d03bcf0683913e606059f82dcf4d
|
@@ -145,9 +145,9 @@ module Motor
|
|
145
145
|
# @param filters [Hash]
|
146
146
|
# @return [String]
|
147
147
|
def build_select_sql(connection_class, sql, limit, filters)
|
148
|
-
sql = sql
|
148
|
+
sql = normalize_sql(sql)
|
149
149
|
|
150
|
-
subquery_sql = Arel.sql("(#{sql})
|
150
|
+
subquery_sql = Arel.sql("(#{sql})").as(connection_class.connection.quote_column_name(SUBQUERY_NAME))
|
151
151
|
|
152
152
|
arel_filters = build_filters_arel(filters)
|
153
153
|
|
@@ -198,6 +198,10 @@ module Motor
|
|
198
198
|
[sql, 'SQL', attributes]
|
199
199
|
end
|
200
200
|
|
201
|
+
def normalize_sql(sql)
|
202
|
+
sql.strip.delete_suffix(';').gsub(/\A\)+/, '').gsub(/\z\(+/, '')
|
203
|
+
end
|
204
|
+
|
201
205
|
# @param variable_configs [Array<Hash>]
|
202
206
|
# @param variables_hash [Hash]
|
203
207
|
# @return [Hash]
|
@@ -45,7 +45,8 @@ module Motor
|
|
45
45
|
|
46
46
|
klass.instance_eval do
|
47
47
|
default_scope do
|
48
|
-
from(Arel.sql("(#{self.klass.instance_variable_get(:@__motor_custom_sql)})")
|
48
|
+
from(Arel.sql("(#{self.klass.instance_variable_get(:@__motor_custom_sql)})")
|
49
|
+
.as(connection.quote_column_name(table_name)))
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
data/lib/motor/version.rb
CHANGED