app/assets/javascripts/modularity/data/indexed_cache.coffee in modularity-rails-0.16.0 vs app/assets/javascripts/modularity/data/indexed_cache.coffee in modularity-rails-0.17.0
- old
+ new
@@ -2,11 +2,11 @@
# Provides fast and convenient retrieval of hash objects
# by indexing them on a given key column.
class modularity.IndexedCache
- constructor: (@key) ->
+ constructor: (@key = 'id') ->
@cache = new modularity.Cache
add: (entry) ->
@cache.add entry[@key], entry
@@ -19,10 +19,10 @@
remove: (entry) ->
@cache.remove entry[@key]
remove_many: (entries) ->
- @cache.remove_many entries
+ @cache.remove_many (entry[@key] for entry in entries)
get: (key) ->
@cache.get key