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?
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.
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