pg_cache_key 0.1.2 → 0.1.3
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/pg_cache_key/version.rb +1 -1
- data/lib/pg_cache_key.rb +1 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a22d3542adbbdf55f3f09a4cb510986b50d5e87
|
4
|
+
data.tar.gz: a8bcb86f6338109deb7c09905d5241aa0f568550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37ad5b28ebc8351f40fe50cc8523d446897d1d179ce7533f25a3912dc37619f468b78e733200c3ed80559672d59bae58dd359ca21a732798ce5e672d9e17ca88
|
7
|
+
data.tar.gz: b4089abc9ac26384361d95224b7358d48378a136e23498427afae6a6256e383d92e8bbaf7a5fab8eecc12a5b88cafd70358ea5058995e183d8df1987ccc43c11
|
data/lib/pg_cache_key/version.rb
CHANGED
data/lib/pg_cache_key.rb
CHANGED
@@ -26,10 +26,8 @@ module ActiveRecord
|
|
26
26
|
# Rem 1: why use connection.execute instead of doing collection.select because of an order. if you using some order on your scope
|
27
27
|
# then columns you using to order must appear in the GROUP BY clause or be used in an aggregate function or you will get an error
|
28
28
|
# Rem 2: we need to add select( cache_columns ) explicitly because if relation has includes it might transform columns to aliases
|
29
|
-
# joins(values[:includes]).unscope(:includes) - we need to move includes to joins to avoid all aliases and so
|
30
|
-
# we can't unscope(:includes) completly because some where can depend on it
|
31
29
|
@cache_keys[timestamp_column] ||= connection.execute( "SELECT md5(string_agg( #{cache_columns.map{|fld| "\"t\".\"#{fld}\"::text" }.join('||')}, '') ) as cache_key
|
32
|
-
FROM (#{
|
30
|
+
FROM (#{ select(cache_columns).try(:to_sql) }) t" )[0]['cache_key']
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|