I’ve been having some trouble figuring these two (probably simple)
feats.
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
(http://www.ruby-forum.com/topic/76716#120542) 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 => "#{@user.id}.vcf",
:type => 'text/directory'
end
Any help is much appreciated, I am very new to rails but am learning a
lot thanks to this forum.