Hi,

I get an XML like this from a hotel API -

    <name>Oriental Riverside Hotel - Pudong Shanghai</name>
    <address1>No. 2727, Riverside Ave., Pu</address1>
    <address2/>
    <address3/>
    <city>SHANGHAI</city>
    <stateProvince/>
    <country>CN</country>
    <postalCode> </postalCode>
    <airportCode>SHA</airportCode>

in rhtml page, I get an error -

ActionView::TemplateError (can't convert Hash into String) on line #36
of app/views/hotels2/city_hotels.rhtml:
33:     address += ' '
34:
35:     if hotel['postalCode'][0].is_a?(Hash)
36:         address += hotel['postalCode'][0]
37:     end
38:
39:     description = hotel['shortDescription'][0]

It is not able to interpret empty postal code tag correctly. How should
I handle it?

Thanks

/r
http://www.pilotoutlook.com
-- 
Posted via http://www.ruby-forum.com/.