在heroku上使用回形针宝石

在heroku上使用回形针宝石,heroku,paperclip,Heroku,Paperclip,我有一个名为post的模型,我正在尝试使用回形针gem为post添加一个图像内容,在本地运行时效果很好。但当我在heroku上部署它时,它会抛出一个错误“图像的内容与报告的内容不同” 后模型是 class Post < ActiveRecord::Base belongs_to :topic has_many :comments has_many :ratings belongs_to :user #scope :recent, -> {where :user_

我有一个名为post的模型,我正在尝试使用回形针gem为post添加一个图像内容,在本地运行时效果很好。但当我在heroku上部署它时,它会抛出一个错误“图像的内容与报告的内容不同”

后模型是

class Post < ActiveRecord::Base
  belongs_to :topic
  has_many :comments
  has_many :ratings
  belongs_to :user

  #scope :recent, -> {where :user_id = 3)}

  scope :t , ->(from) { where("posts.created_at > ?", from) }
  scope :f , ->(from) { where("posts.created_at < ?", from) }
  #scope :created_before, ->(time) { where("created_at < ?", time) }

  has_and_belongs_to_many :users , join_table: :posts_users_read_status
  has_and_belongs_to_many :tags

  has_attached_file :image


  validates_presence_of :name, :presence => true,message: "Name should not be blank"
  validates_length_of :name,:maximum => 20,message: "Maximum 20 characters are allowed"
  validates_attachment :image
  validates_attachment_content_type :image, content_type: "image/jpeg"

  validates_attachment_size :image, :in => 0..1024.kilobytes
  do_not_validate_attachment_file_type :image
end
class Post{where:user_id=3)}
范围:t,->(from){where(“posts.created_at>?”,from)}
范围:f,->(from){where(“posts.created_at<?”,from)}
#范围:创建时间之前,->(时间){where(“创建时间<?”,时间)}
拥有和属于多个用户:用户,加入表格::发布用户阅读状态
_和_属于_多个:标记吗
是否已附加文件:图像
验证\u presence\u of:name,:presence=>true,消息:“name不应为空”
验证以下内容的长度:name,:max=>20,消息:“最多允许20个字符”
验证_附件:映像
验证附件内容类型:图像,内容类型:“图像/jpeg”
验证\u附件\u大小:image,:in=>0..1024.KB
不验证附件文件类型:图像
结束
邮寄表格如下:

<%= form_for [@topic, @post],:html => {:class => "postsform",:multipart => true}, :remote => true  do |f| %>
            <% if @post.errors.any? %>
            <div id="error_explanation">
              <h2><%= pluralize(@post.errors.count, "error") %> prohibited this topic from being saved:</h2>

              <ul>
                <% @post.errors.full_messages.each do |message| %>
                    <li><%= message %></li>
                <% end %>
              </ul>
            </div>
        <% end %>

    <div class="images">
      <%= f.label :image %><br>
      <%= f.file_field :image,class: "form-control" %>
    </div>
  <div class=namefield">
    <%= f.label :Name %><br>
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :message %><br>
    <%= f.text_area :message %>
  </div>


   <div class="Tags">
    <%= f.label :Tags %><br>

        <% @tags.each do |tag| %>
            <div>
            <%= check_box_tag "post[tag_ids][]", tag.id, @post.tags.include?(tag) %>
            <%= tag.name %>
            </div>

  <% end %> 
</div>
    <%= link_to 'Create New Tags', tags_path %>
    <div class="actions">
      <div id="loading-indicator">
        <%= image_tag("\assets\images\ajax-loading.gif", :id => "loading-indicator", :style => "display:none") %>
      </div><%= f.button "Post", data: {disable_with:'<i class="fa fa-spinner fa-pulse"></i>Posting in'} ,id:"postb"%>
  </div>
<% end %>
{:class=>“postsform”,:multipart=>true},:remote=>true do | f |%>
禁止保存此主题:

2016-01-06T04:33:01.991166+00:00 app[web.1]: [paperclip] Content Type Spoof: Filename images_(3).jpg (image/jpeg from Headers, [#<MIME::Type:0x007f63421e07d8 @content_type="image/jpe
g", @raw_media_type="image", @raw_sub_type="jpeg", @simplified="image/jpeg", @media_type="image", @sub_type="jpeg", @extensions=["jpeg", "jpg", "jpe"], @encoding="base64", @system=ni
l, @registered=true, @url=["IANA", "RFC2045", "RFC2046"], @obsolete=nil, @docs=nil>] from Extension), content type discovered from file command: . See documentation to allow this com
bination.