We've moved discussions to Discord

Active Storage Image Broken

Bryan Stewart
Hello Group,
I am looking to attach a couple different images to a Programs model. It will have a program image and an instructor pic.

Right now , I just added a single image to the model
has_one_attached :image, dependent => :destroy

I also allowed the :image param in the param list on the controller

I added form.file_field :image

I have this in the show page

<% if program.image.attached? %>
<%= image_tag program.image.variant(resize: "500x500") %>
<% end %>
This shows broken image but the inspection looks right
< img src="http://localhost:3000/rails/active_storage/representations/redirect...aW9...../image.png">

Anyone come across this? I am sure its an easy fix.
What is the best way to have to images attached to the model.

I originally added two fields:string for this
pic:string
instructor_pic:string

TIA
Bryan Stewart
i skipped the variant and sized it in class. url(program_image) worked in this case
Notifications
You’re not receiving notifications from this thread.