search for: disc_number

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

Did you mean: desc_number
2012 Jan 27
2
to_json performance
...ing 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 are transforming and ins...