Derek Neighbors wrote:
i'm doing a site for someone that has a form set up to collect contact information from the user. i installed the vpim gem and was hoping to give my client a way to download all of the contact's information as a vcard. using the examples, i was able to get it working in ruby,
but i'm not quite sure how to generate and download a vcard on the fly.has anyone done anything like that?
We are doing this using the SimplyRESTful stuff...
In the controller for example we have:
def show respond_to do |format| format.html format.xml { render :xml => @contact.to_xml } format.vcf do send_data @contact.to_vcard, :filename => "#{@contact.id}.vcf", :type => 'text/directory' end end end
Using this technique gives me a server response with:
"uninitialized constant Mime::VCF"
I found several mime-type related files in the following directory: /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ mime_responds.rb mime_type.rb mime_types.rb
Is there a way to add the .vcf mime-type?