生产中的回形针验证问题 [英] Paperclip validation issue on production

查看:240
本文介绍了生产中的回形针验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Google云上部署应用程序时遇到问题我收到此错误


包含的内容并非他们所报告的内容成为

在本地它可以正常工作!我已经尝试使用command_path。所以我真的不知道接下来我该怎么做......



这是我的模特

  has_mongoid_attached_file:image,
:styles => {:大=> 380x380! ,:medium => 240x240,:small => 120×120! },
:storage => :fog,
:fog_public => true,
:fog_directory => 'XXXX',
:path => images /:id /:style /:basename。:extension,
:fog_credentials => {:provider => 'Google',
:google_storage_access_key_id => 'XXXXX',
:google_storage_secret_access_key => 'XXXXX'}

validates_attachment_content_type:image,:content_type => [image / jpg,image / jpeg,image / png,image / gif]

感谢您的努力。我希望你们能帮助我解决方案

好的,我找到了一个结果。我刚创建了一个初始化器/ paperclip.rb 文件

  require'paperclip / media_type_spoof_detector'
模块Paperclip
类MediaTypeSpoofDetector
def欺骗?
false
end
end
end

正确现在它对我来说是完美的。

如果您在使用Rails的App Engine上使用ImageMagick时遇到问题,请参阅链接


I have a Problem when I deploy my application on google cloud I get this error

has contents that are not what they are reported to be

Locally it works fine! I already tried to using the command_path. So I really don't know what I have to do next...

This is my model

has_mongoid_attached_file  :image,
    :styles => { :large => "380x380!" , :medium => "240x240", :small => "120x120!" },
    :storage => :fog,
    :fog_public => true,
    :fog_directory => 'XXXX',
    :path => "images/:id/:style/:basename.:extension",
    :fog_credentials => {  :provider => 'Google',
                           :google_storage_access_key_id => 'XXXXX',
                           :google_storage_secret_access_key => 'XXXXX'}

  validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png", "image/gif"]

Thank you for your efforts. I hope you guys can help me

解决方案

Okay I found a result. I just created a initializers/paperclip.rb file

require 'paperclip/media_type_spoof_detector'
module Paperclip
  class MediaTypeSpoofDetector
    def spoofed?
      false
    end
  end
end

Right now it work's perfectly for me.

If you have problems with ImageMagick on App Engine using Rails see this link

这篇关于生产中的回形针验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆