All threads / Can't resolve image into URL: undefined method `attachment_url' for #<#<Class:0x0 ...
Ask A Question

Notifications

You’re not receiving notifications from this thread.

Can't resolve image into URL: undefined method `attachment_url' for #<#<Class:0x0 ...

almokhtar asked in Rails

Can't resolve image into URL: undefined method `attachment_url' for #<#Class:0x00007f9f6098f308:0x00007f9f6493d770>

I spent hours to solve it but nothing !!
Env: ruby : ruby 2.6.5p114 | Rails 6.0.2.2
what i did :
rails active_storage:install
rails db:migrate
has_one_attached :main_image
<%= f.label :main_image %>
<%= f.file_field :main_image %>
<%= image_tag event.main_image %>

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 70,078+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.