This line of rubypress code:
:type => MIME::Types.type_for(FILENAME).first.to_s,
is barfing with the following error:
NameError: uninitialized constant MIME
The whole block is:
FILENAME='myFile.png'
wp.uploadFile(:data => {
:name => FILENAME,
:type => MIME::Types.type_for(FILENAME).first.to_s,
:bits => XMLRPC::Base64.new(IO.read(FILENAME))
})
Any suggestions what the problem is?
Add
require 'mime/types'
to the top of your file.A little late to the party.
After a recent Ruby upgrade, I’ve found that
MIME::TYPES
could not be initialized. A more modern solution is to use marcel, which is already included as a dependency with the recent rails version.