search for: play_count

Displaying 1 result from an estimated 1 matches for "play_count".

Did you mean: day_count
2012 Jan 27
2
to_json performance
...each Array representing the requested record values in a Hash with keys mapped, like so: class Hash def self.transpose(keys, values) self[*keys.zip(values).flatten] end end keys = %W{token artist album genre release_year title duration duration_in_seconds position play_count favorited disc_number} my_hash = @playlist.media_files.ordered.values_of(*keys).collect{ | v| Hash.transpose(keys, v) } Nice, now we have a Array of Hash without instantiating AR objects but with all the info we need about our objects. This operation proved to be _extremely_ fast even if we ar...