There is a user model:
class User < ActiveRecord::Base has_many :posts, dependent: :destroy has_many :comments, dependent: :destroy has_attached_file :avatar, styles: { medium: "300x300>", thumb: "100x100>" }, default_url: "/images/:style/missing.png" validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\Z/ devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable end
Code in views:
<p> <strong>Avatar:</strong> <br> <%= image_tag @user.avatar.url(:medium) %> </p>
Did everything according to the documentation https://github.com/thoughtbot/paperclip If the user does not have an avatar, then it is not displayed. In the / assets / images folder there is an image of missing.png, but I get at the output
It turns out an error in the example developer
How to solve a problem?