-
-
Save sirchuck/3ad1f276a177fa337201601fd55b3e1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my_array = [] | |
my_object = { | |
:one => "0", | |
:two => "0", | |
:three => "0", | |
} | |
other_array = ["1","2","3"] | |
other_array.each do |id| | |
my_object[:one] = id | |
my_array << my_object | |
end | |
# my_array[:one] will equal 3 for each array element. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment