I'm trying to upload avatars for existing users in my rails app using ActiveStorage, but after uploading an image through the devise edit page, it doesn't display the image.
User model
class User < ActiveRecord::Base
has_one_attached :avatar
end
Application_controller
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:account_update) { |u| u.permit(:username, :first_name, :last_name, :email, :password, :currentpassword, :remember_me, :avatar)}
end
devise/registrations/edit.html.erb
<div class="field">
<% if @user.avatar.attached? %>
<%= image_tag @user.avatar %>
<% end %>
</div>
<div class="field">
Upload a Profile Picture
<%= f.label "Profile Picture" %>
<%= f.file_field :avatar %>
</div>