This problem i have been trying to solve with the help of stack over websites. But unfortunately i can't do so. So i decided to ask a helping hand instead.
I have tried all those links to solve this problem. But none of them work.
http://stackoverflow.com/questions/25934465/rails-paperclip-not-showing-image
http://stackoverflow.com/questions/9170335/paperclip-images-not-displaying-in-rails-app
http://stackoverflow.com/questions/23971226/rails-image-not-showing-up-with-paperclip
http://stackoverflow.com/questions/31348628/paperclip-not-showing-image-even-though-url-images-in-correct-places
http://stackoverflow.com/questions/7425001/specifying-missing-png-in-paperclip
http://stackoverflow.com/questions/25249252/paperclip-where-to-place-the-
missing-png-default-image
http://stackoverflow.com/questions/38734116/ruby-paperclip-how-to-get-missing-png-to-work
Now my problem is that it's always displaying a square image saying missing.
Below is my code
Recipe.rb
class Recipe < ApplicationRecord
has_attached_file :image, styles: { medium: "400x400#" },
:path => ":rails_root/public/system/:attachment/:id/:style/:filename",
:url => "/system/:attachment/:id/:style/:filename"
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
end
Recipe's show.html.haml
= image_tag @recipe.image.url(:medium, class: "recipe_image")
Recipe's new.html.haml
= simple_form_for @recipe, html: { multipart: true } do |f|
- if @recipe.errors.any?
#errors
%p
= @recipe.errors.count
Prevented this recipe froms saving
%ul
- @recipe.errors.full_messages.each do |msg|
%li= msg
.panel-body
= f.input :title, input_html: { class: 'form-control' }
= f.input :description, input_html: { class: 'form-control' }
= f.input :image, input_html: { class: 'form-control' }
= f.button :submit, class: "btn btn-primary"