Sha256: bb3781a0bbf7e34fd681abd9d55f8523eae26a5b55d60f5fc32f2a1503443fbd
Contents?: true
Size: 522 Bytes
Versions: 7
Compression:
Stored size: 522 Bytes
Contents
module ActiveMetadata::Streamable def stream_for field sort_stream(collect_stream_data(field)) end private def sort_stream stream stream.sort{|a,b| b.updated_at <=> a.updated_at} end def collect_stream_data field res = [] ActiveMetadata::CONFIG['streamables'].each do |model| res.concat self.send(stream_collect_method(model.to_s),field).collect { |el| el } end res end def stream_collect_method model model.to_s == 'note' ? 'notes_for' : 'attachments_for' end end
Version data entries
7 entries across 7 versions & 1 rubygems