デフォルトプロフィール画像が変わらない
railsでアプリケーションを作成しています
active storageを使ってデフォルトのプロフィール画像を表示させているのですが
以前の画像から新しい画像に変えようと思い、以前の画像をフォルダーから削除し、新しい画像をフォルダーにアップロードしました。
ですがリロード rails s を実行しても以前の画像のままになってしまいます
どうすれば良いでしょうか
よろしくお願いいたいします
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
has_many :books, dependent: :destroy
has_one_attached :profile_image
def get_profile_image(width, height)
unless profile_image.attached?
file_path = Rails.root.join('app/assets/images/no-image.jpeg')
profile_image.attach(io: File.open(file_path), filename: 'default-image.jpg', content_type: 'image/jpeg')
end
profile_image.variant(resize_to_limit: [width, height]).processed
end
end
0 likes