Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 213383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:16:24+00:00 2026-05-11T18:16:24+00:00

First, a little background, because there is a lot of interaction going on: I’m

  • 0

First, a little background, because there is a lot of interaction going on: I’m grabbing emails via Fetcher, and processing them using MMS2R to extract the attachments. These attachments are generally going to be PDF files or MS Word documents, so you’d expect that their content-type would be application/pdf and application/msword respectively, but unfortunately it appears that many mail programs do not do this.

Instead, the attachments are application/x-pdf and application/x-doc. I need these to be set correctly so that scribd-fu will properly iPaper the documents. Now, mimetype-fu will manage to figure out the proper content-type, but for the life of me, I just can figure out how to properly set the content-type of the paperclip’d attachment.

Here’s a snippet of the code:

mms.process do |media_type, files|
  # go through each file
  files.each do |filename|
    # if it's a format we support, create a record
    if media_type =~ /pdf/  # just pdfs for now, to reduce confusion
      File.open(filename) do |tempfile| 
        # Somewhere in here I'd like to change filename.content_type
        # to the proper type using mimetype-fu
        # except doing tempfile.content_type = whatever doesn't seem to work.

        thing = Thing.new
        thing.document = tempfile
        thing.save!
      end
    end
  end
end

Any help would be appreciated, because I’ve been beating my head against a wall trying all manner of things to try to get this working. I’ve tried these links already either without success or without grokking what needs doing:

  • http://gist.github.com/55009/
  • http://railsforum.com/viewtopic.php?id=27448
  • http://github.com/dbackeus/paperclip/commit/a514bd03664fc6a764787f59c3169397336702b1

Thanks greatly!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:16:24+00:00Added an answer on May 11, 2026 at 6:16 pm

    Can you just do

    thing.document_content_type = whatever
    

    or are you doing your scribd-fu in document= or something?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First a little background: I have already managed to connect to a Microsoft SOAP
A little background first. I've been tasked with encrypting files with a Powershell script
A little background first: I'm a designer/developer and decided to use subversion for a
First, a little background. I have strings that resemble the following: ((Foo.Bar.StartsWith(A)) && (Foo.Bar.EndsWith(B)))
First I will give a little background info so this question isn't completely without
First, a little background. I have two ASP.NET web applications that use SQLServer session
First a little background. I got a warning in NetBeans told me not to
First a little background. I am building a mobile app for a client, this
First, a little background (greatly simplified): I have two classes, one called Entity and
First, a little background. Currently namespaces and assemblies in our codebase (~60 assemblies, thousands

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.