Sha256: b744afb3fa90035b05c56059d0485a2bcf0f584cef44b6f19e3d0abcbcb9363b
Contents?: true
Size: 613 Bytes
Versions: 10
Compression:
Stored size: 613 Bytes
Contents
module CassandraObject module FindWithIds extend ActiveSupport::Concern module ClassMethods def find_with_ids(ids, options=nil) expects_array = ids.first.kind_of?(Array) return ids.first if expects_array && ids.first.empty? ids = ids.dup ids.flatten! ids.compact! ids.collect!(&:to_s) ids.uniq! #raise RecordNotFound, "Couldn't find #{record_klass.name} without an ID" if ids.empty? results = multi_get(ids).values.compact results.size <= 1 && !expects_array ? results.first : results end end end end
Version data entries
10 entries across 10 versions & 1 rubygems