On 19 Feb 2009, at 10:54, Cyrus Dev wrote:

>
> Hello all
>
> any one has idea how to add new column to existing hash array ?
>
by hash array do you mean an array of hashes ?
> I have one hash instance like
> @restaurant
>
> using each with index i m looping it and want to add new key and value
> to each row
>
unless i'm missing part of the question, you just do it.

array_of_hashes.each_with_index do |some_hash, i|
   some_hash[:foo] = :bar
end

If you want to change the array you are iterating over, that isn't  
supported.

Fred
> how can i do that ?
>
> please help me
>
> thanks
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to