Forum: Ruby on Rails Attachment_fu and vCards (2 questions)

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Bade74fdeeaa357a9f8f37211dfe4d2d?d=identicon&s=25 Monjurul Dolon (monjurul)
on 2007-06-14 10:14
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
( 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.
4e8fa998ac72fc1910c89233cc36dc71?d=identicon&s=25 gigelmund (Guest)
on 2008-12-11 11:25
(Received via mailing list)
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 Dolon <rails-mailing-l...@andreas-
This topic is locked and can not be replied to.