ocean-rails 3.5.2 → 3.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 195596beb3c2e277dbbb62f5c03d9dc0ece243ff
4
- data.tar.gz: a8408d92783ede7f1ed14a72ea0dbb5786d18f36
3
+ metadata.gz: c814db3aeba4c0c87d38123131d8a4be8b53cdbd
4
+ data.tar.gz: d2f2a95a83153e326922ce182286843de5f9d511
5
5
  SHA512:
6
- metadata.gz: 7aa31ceab000b88c62f671e1a56ad1c3fb5280e9b8526f124d7de68667ad7b404094a6556c6921272e39340e91cbd0da74d939bac7851a95846252bf860a2925
7
- data.tar.gz: ed19424f8890bbf34eeb9a0b8adaf62df7f78f7c2286ef9c8a6c59076d9cba00eeb4d05a1385b6f3ee5a9abcf8e9c1f9697fa2c8a9aa6708700d7e5b83ffa993
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 or a scope. The cache value
242
- # is based on three components: (1) the name of the class, (2) the number of
243
- # members in the collection, and (3) the modification time of the last updated
244
- # member.
245
- #
246
- def collection_etag(coll)
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
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "3.5.2"
2
+ VERSION = "3.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.2
4
+ version: 3.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson