[RUBY] Rails: When the image is no longer displayed using refile (the story was just fill → size)

At first

** Day 20 of Calendar Planning 2020 ** It's been about 3 months since I started studying programming, so I will leave a note of what I learned in the article as an output. I would be happy if I could help anyone entering the world of programming. Please let me know if there are any words that are wrong, wrong, or misunderstood ^^ I'm sorry if it's hard to read the words for a long time. I will do my best to get used to it little by little.

The problem that the image is not displayed when using attachment_image_tag after introducing gem refile

This is a note of what happened when I was actually creating the web application.

What happened

When I first created it, the image was displayed, but one day it suddenly disappeared and I panicked ^^;

environment

environment



Rails 5.2.4.4
ruby 2.6.3
gem "refile", require: "refile/rails", github: "manfe/refile"
gem "refile-mini_magick"

Screen display when waking up

スクリーンショット 2020-12-20 11.25.28.png

Such a guy

After improvement

スクリーンショット 2020-12-20 11.25.58.png

How did you solve it?

Actual code (when a problem occurs)



<%= attachment_image_tag @member, :profile_image, :fill, 60, 60, format: "jpeg", fallback: "no_image.jpg ", class: "img-circle" %>

Actual code (after resolution)



<%= attachment_image_tag @member, :profile_image, format: "jpeg", size: "60x60", fallback: "no_image.jpg ", class: "img-circle" %>

The cause is : fill, 60, 60 ← It looks like this ↓ size:" 60x60 " ← Change to this (using lowercase x)

I solved it by changing fill to size. Is a story

Finally

When I look it up I changed the order because there was only one that changed the order with format, but it was displayed for the time being without changing. I don't know the reason yet, so I'll update it when I find out.

I felt once again that it is important to practice this kind of thing because it is something that cannot be understood without actually making it.

Recommended Posts

Rails: When the image is no longer displayed using refile (the story was just fill → size)
[Rails] What to do when the Refile image is not displayed when writing the processing at the time of Routing Error
The story when the test folder was not created in Rails
[Rails] I was addicted to the nginx settings when using Action Cable.
A story I was addicted to when testing the API using MockMVC
[Rails] About the error that the image is not displayed in the production environment
When the project is not displayed in eclipse
[Ruby on rails] When executing the heroku command, bash: heroku: command not found is displayed. [Rails tutorial]
[Android Studio] About the matter that the design view is not displayed when using TextClock