mardi 4 août 2015

Unexpected label while trying to iterate over a ruby hash

I am in the process of trying to iterate over a ruby hash. I'll have to admit that my knowledge of ruby is very poor and i am in the process of trying to correct that, and so please bear with me if this is a very elementary question.

I am wondering if the syntax of my hash is off. The reason why it is looking the way that it is is because it is part of a rakefile, and i need to incorporate multiple addresses in this. (which i've never done, i've always only had 1 address to worry about) I know the solution to this is to build the addresses in as a rakefile, and then loop over them.

clinic.build_address.each do | build_address |
                            {
                              (city: "Minneapolis",
                              state: "MN",
                              address1: "316 10th ave",
                              zip: "55414"),
                              (city: "Hudson",
                              state: "WI",
                              address1: "119 Belmont Street",
                              zip: "54016")
                            }

With what I have right now I am getting an unexpected label (it is not liking that I have 'city:minneapolis')

Would anybody be able to take a quick look at what I have with this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire