I'm attempting to use a form to upload and store Sublime Text themes in a database.
It works fine with images, but replacing the content_type with the one applicable to Sublime Text theme files consistently tells me that the file "has contents that are not what they are reported to be"
class Color < ActiveRecord::Base
has_attached_file :file
validates_attachment_content_type :file, :content_type => ["image/png"]
end
Works fine
class Color < ActiveRecord::Base
has_attached_file :file
validates_attachment_content_type :file, :content_type => ["application/xml"]
end
Does not
I think you might need to tell Paperclip (I'm assuming that's what you are using) that 'tmtheme' is a valid extension by adding this to your config/environments/development.rb
and config/environments/production.rb
:
Paperclip.options[:content_type_mappings] = {
:tmtheme => "application/xml"
}