A mistake made when displaying an image using Active Storage

This article may not be relevant to those who have implemented the functionality correctly ... I was creating something like a message posting function using Active Storage. I created a view file that displays the posted message, so when I tried to check the behavior, an error occurred. Why is the logic correct?

Cause

When I was checking the behavior during development, I remembered that I was able to post even if I did not attach an image. Post data of only messages was registered in the table when the association by has_one_attached was not well organized. As mentioned above, an error occurred when opening the view file created this time because the association was formed.

Solutions

In my case, I had introduced Sequel Pro that can check the status of the table, so I deleted only the record directly and responded. Normally, I think it would be more correct to reset the table, but if it's personal development, I wonder if this is fine ... (not good)

As mentioned above, it was an event that I felt that it was necessary to have a broad perspective that could consider not only logic but also different aspects.

Recommended Posts

A mistake made when displaying an image using Active Storage
I made a mistake when installing VLC on Ubuntu 18.04 via snap
Note: Image storage using AWS S3
When I ran a jar created using WildFly Swarm, I got an InvocationTargetException.
Duplicate an object using a generic type
[Active Storage] Validation settings when uploading files
A reminder when an aapt.exe error occurs
I made a bulletin board using Docker 1
How to implement image posting function using Active Storage in Ruby on Rails
A story about saving an image with carrierwave in a nested form using a form object.
Problem of slow processing when using Active Storage with cloud storage (GCS, S3, etc)
When using a list in Java, java.awt.List comes out and an error occurs