Attachment_fu and vCards (2 questions)

I’ve been having some trouble figuring these two (probably simple)

First, is there a way to make attachment_fu override files a user
uploads? I figure one way would be to make all the filenames and paths
be the same, like /path/user_id.extension, but my problem is that the I
am accepting 3 different formats for the files (doc, pdf and txt) and
I’m not sure how to set the proper extensions.

I tried searching far and low but couldn’t find much. Ideally it would
be perfect if the filenames could be kept the same and I could some how
check to find a user’s file in my create function and destroy it if it
exists (destroy doesn’t seem to work within create).

My second question involves using the vpim gem to export user data in
the vcard format. I followed an example I found on this forum
(Exporting vcards from rails - Rails - Ruby-Forum) almost exactly but
receive the following error: “uninitialized constant Mime::VCF” pointing
to this bit of code:

 format.vcf do
    send_data @user.to_vcard, :filename => "#{}.vcf",
      :type => 'text/directory'

Any help is much appreciated, I am very new to rails but am learning a
lot thanks to this forum.

Having the same problem with vpim while requesting the vcard via:

The controller code:

def show
@contact = Contact.find(params[:id])

respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml => @contact }
  format.vcf do
    send_data @contact.to_vcard_test, :filename => "#

{}.vcf", :type => ‘text/x-vcard’

And the respond of the webserver:
“uninitialized constant Mime::VCF”

Any suggestions?


On 14 Jun. 2007, 09:14, Monjurul D. <rails-mailing-l…@andreas-