search for: my_hash

Displaying 5 results from an estimated 5 matches for "my_hash".

Did you mean: mn_hash
2006 Jul 29
9
export to a CSV or XLS file
hello everyone, Any idea how can i export a resultset from a database to a CSV or XLS file from the application ? would like the user to have the option to export selected data to a CSV/XLS file. Any plugins or libraries avaiable to accomplish this ? Thanks for your time, VASU. -- Posted via http://www.ruby-forum.com/.
2006 Mar 31
6
how to access a hash within a hash in ruby?
Simple question: I know how to access a data field in a hash by doing hash_name[datafield_name]. But what if the datafield itself is a hash? I tried a couple of variations but nothing seems to be working and tutorials do not go into such details. Is there a simple way or should I create separate instances? -Chris -- Posted via http://www.ruby-forum.com/.
2012 Jan 27
2
to_json performance
...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 inserting 50k re...
2006 May 02
4
ordering after a inject
Hi, My results are getting out of order after I do the following command: count = result.inject({}) { |hsh, row| hsh[row[''name'']] = row[''count''].to_i; hsh } Why? Here are more specifics: My complete method is this (based off of acts_as_taggable code - not'' DHHs, but the original one): def self.sql_to_count_plays(lookback) sql =
2006 Jul 12
12
pass hash as parameter
Hello, How can I pass a hash as parameter from a template with url_for? e.g. : if I have test = { :a => "a", :b => "b" } How can I pass that with my request? Is it possible to pass nested hash''es to? Right now, url_for :action => :test, test doesn''t seem to work. Thank you, --