search for: values_of

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

Did you mean: value_of
2012 Jan 27
2
to_json performance
...d, 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 inserting 50k records. Now, on to the rendering: ren...