L
L
lif3ar2015-06-08 04:07:09
Ruby on Rails
lif3ar, 2015-06-08 04:07:09

How to fix error loading image in Paperclip?

Can't get Paperclip to load image in simple_form.
When sending content, it gives in the image line: "has contents that are not what they are reported to be".
I couldn't find any information about this error on Google.
gem 'paperclip', '~> 4.2.2'
Model:
has_attached_file :image, styles: { medium: "700x500#", small: "350x250#" }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z /
Controller:
def post_params
params.require(:post).permit(:image)
end
View:
<%= image_tag post .image.url(:medium) %>
simple_form form:
<%= simple_form_for post do |f| %>
<% end %>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Evgeny Tkachenko, 2015-06-08
@eugene20tkachenko

<%= simple_form_for post , html: {multipart: true} do |f| %>

L
lif3ar, 2015-06-08
@lif3ar

<%= simple_form_for @post, html: {multipart: true} do |f| %> - no change

C
caution, 2015-06-09
@caution

downloadable format?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question