Here's how my model looks like.
class Bug < ApplicationRecord
has_many :bug_users, dependent: :destroy
has_many :users , through: :bug_users
belongs_to :project
has_one_attached :screenshot
end
The uploading part is working just fine but when i am displaying it in the view like this
<% @bugs.each do |bug| %>
<p>
<strong>Title:</strong>
<%= bug.title %>
</p>
<p>
<%if bug.screenshot.present? %>
<strong>Screenshot:</strong>
<%= image_tag bug.screenshot %>
<%end%>
</p>
<% end%>
Aucun commentaire:
Enregistrer un commentaire