# Prob with address field import using vPim/vCard

**URL:** <https://www.ruby-forum.com/t/prob-with-address-field-import-using-vpim-vcard/172454>\
**Category:** Rails\
**Created:** [July 21, 2009, 8:43pm UTC](https://www.ruby-forum.com/t/prob-with-address-field-import-using-vpim-vcard/172454 "2009-07-21T20:43:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lunaclaire](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/f4b2a3/32.png) [@lunaclaire](https://www.ruby-forum.com/u/lunaclaire)\
**Post date:** [July 21, 2009, 8:43pm UTC](https://www.ruby-forum.com/t/prob-with-address-field-import-using-vpim-vcard/172454/1 "2009-07-21T20:43:23Z")

</div>

I’m successfully using the vpim/vcard gem to import from a vcard file  
except for one part… the physical address fields.

the docs are pretty sketchy and there isnt much when you google for  
info, so I’m wondering if anybody can help.

my prob is that when I’m trying to process the addresses, I must be  
looking at the wrong part of the data, 'cause it comes up blank (when  
the cobbled together data I’m using for dev definitely has data  
there).

I currently have the following code:

card.addresses.each do |a|  
addrs = “”  
addrs += a.pobox.to\_s + ‘\n’ unless a.pobox.to\_s.blank?  
addrs += a.street.to\_s + ‘\n’ unless a.street.to\_s.blank?  
addrs += a.locality.to\_s + ', ’ unless a.locality.to\_s.blank?  
addrs += a.region.to\_s + ’ ’ unless a.region.to\_s.blank?  
addrs += a.postalcode.to\_s unless a.postalcode.to\_s.blank?  
addrs += ‘\n’ + a.country.to\_s unless a.country.to\_s.blank?

```
location = a.location.to_s
if location == 'home' || location == '' || a.location.blank?
  options[:home_addrs] = addrs
elsif location == 'work'
  options[:work_addrs] = addrs
end

```

end

I thought these attributes were all Strings, but it’s not seeming that  
way. I tried it initially without the .to\_s and then threw that in  
'cause I found it to be necessary on the a.location piece you see near  
the end. Didnt make a difference.

Does anybody know the proper way to pull this data out?
