ocean-rails 3.5.2 → 3.5.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/ocean/ocean_application_controller.rb +15 -6
- data/lib/ocean/version.rb +1 -1
- 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: c814db3aeba4c0c87d38123131d8a4be8b53cdbd
|
4
|
+
data.tar.gz: d2f2a95a83153e326922ce182286843de5f9d511
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 774e7501fbbaaac2c4d08f26fecafdd6840215ed8382b72acf98e2568e555e128efcf33fea4f3f4277d4bdaf91306031ae2516a093673842331030367f2a3258
|
7
|
+
data.tar.gz: 02fb03eb65c9738d0a1573e2912af9222db4f5d63d26fc177aa894691ee1c78db1fa370f5190635340594c96e1b0a200118b4964935f7c1175e76686587cde69
|
@@ -238,12 +238,21 @@ module OceanApplicationController
|
|
238
238
|
|
239
239
|
|
240
240
|
#
|
241
|
-
# Cache values for collections. Accepts a class
|
242
|
-
# is based on three components:
|
243
|
-
#
|
244
|
-
#
|
245
|
-
#
|
246
|
-
|
241
|
+
# Cache values for collections. Accepts a class, a scope, or an array.
|
242
|
+
# The cache value is based on three components:
|
243
|
+
# (1) the name of the class,
|
244
|
+
# (2) the number of members in the collection, and
|
245
|
+
# (3) the modification time of the last updated member.
|
246
|
+
# If an array is given, the class of the first member will be used to
|
247
|
+
# create a scope. If the array is empty, the optional second argument
|
248
|
+
# will be used as the class indicator.
|
249
|
+
#
|
250
|
+
def collection_etag(coll, klass_name="_unknown_")
|
251
|
+
if coll.is_a? Array
|
252
|
+
return { etag: "#{klass_name}:0:0" } if coll == []
|
253
|
+
# Construct a new scope and fall through
|
254
|
+
coll = coll[0].class.where(id: coll.collect(&:id))
|
255
|
+
end
|
247
256
|
coll = add_right_restrictions(coll, @right_restrictions)
|
248
257
|
klass = coll.name.constantize # Force a load of the class (for secondary collections)
|
249
258
|
timestamp = klass.update_timestamp || klass.create_timestamp
|
data/lib/ocean/version.rb
CHANGED