mercredi 18 septembre 2019

Rails Active Storage not display @user.banner_image

So I've been playing with rails active storage lately and came across an issue.

user.rb

class User < ApplicationRecord
  has_one_attached :banner_image
end


show.html.haml

.profile-header
  = @user.banner_image

in return i get this error:

Can't resolve image into URL: to_model delegated to attachment, but attachment is nil
Extracted source (around line #2):

.profile-header
  = image_tag @user.banner_image

.listings
  - @listings.each do |listing|
    .box


What am I doing wrong? I permitted the banner_image in the user controller by the way. and i have active storage installed.

Aucun commentaire:

Enregistrer un commentaire