paperclip - Using paper clip gem on heroku -


i have model named post , trying add image content post using paper clip gem , works fine when run local. when deploy on heroku throws error "image has contents not reported be"

post model

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 blank"   validates_length_of :name,:maximum => 20,message: "maximum 20 characters 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 

form post

<%= form_for [@topic, @post],:html => {:class => "postsform",:multipart => true}, :remote => true  |f| %>             <% if @post.errors.any? %>             <div id="error_explanation">               <h2><%= pluralize(@post.errors.count, "error") %> prohibited topic being saved:</h2>                <ul>                 <% @post.errors.full_messages.each |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 |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 %> 

heroku logs

2016-01-06t04:33:01.991166+00:00 app[web.1]: [paperclip] content type spoof: filename images_(3).jpg (image/jpeg 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>] extension), content type discovered file command: . see documentation allow com bination. 


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -